上来就是门棍
在openstack (django 1.9)上报告出错。
错误如下
修正后的例子如下
views.py
def fx(request): now = datetime.datetime.now() html = "fx" return HttpResponse(html)
from django.conf.urls import patterns from django.conf.urls import url from openstack_dashboard.dashboards.project.diyiti import views urlpatterns = patterns('openstack_dashboard.dashboards.project.diyiti.views', url(r'^$', views.CourseOverview.as_view(), name='index'), url(r'^create/$', views.CreateView.as_view(), name='create'), url(r'^date/$', 'fx') ) root@node-9:/usr/share/openstack-dashboard#
出错的原因,需要将HttpResponse标记为__unicode__, 所以在urls.py里不应该是
url(r'^date/$', fx)
而应该是
url(r'^date/$', 'fx')