53👍
✅
direct_to_template
has been deprecated. In django 1.5 try using a class based view TemplateView
in urls.py
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^$', TemplateView.as_view(template_name='homepage.html'), name="home"),
)
There’s some information on migrating to version 1.4 (when it was deprecated) here.
2👍
Besides the class-based view TemplateView
, you can also use the render
function like this:
from django.shortcuts import render
urlpatterns = patterns("",
url(r'^$', lambda request: render(request, 'homepage.html'), name="home"),
)
- [Django]-How do I raise a Response Forbidden in django
- [Django]-Django's SuspiciousOperation Invalid HTTP_HOST header
- [Django]-How to 'bulk update' with Django?
Source:stackexchange.com