django1.4以前,url可以这么写
from django.views.generic.simple import direct_to_template url(r'^custom-disallowed/$', direct_to_template, {'template': 'registration/registration_closed.html'}, name='registration_test_custom_disallowed'),
django1.5以后这个方法被彻底废除
from django.views.generic import TemplateView urlpatterns = patterns('', (r'^custom-disallowed/$', TemplateView.as_view(template_name="registration/registration_closed.html"), name='registration_test_custom_disallowed'), )