- from django.conf.urls.defaults import *
- from django.views.generic.simple import direct_to_template
- urlpatterns = patterns('',
- (r'^about/$', direct_to_template, {
- 'template': 'about.html'
- })
- )
- from django.conf.urls.defaults import *
- from django.views.generic.simple import direct_to_template
- **from mysite.books.views import about_pages**
- urlpatterns = patterns('',
- (r'^about/$', direct_to_template, {
- 'template': 'about.html'
- }),
- **(r'^about/(/w+)/$', about_pages),**
- )
- from django.http import Http404
- from django.template import TemplateDoesNotExist
- from django.views.generic.simple import direct_to_template
- def about_pages(request, page):
- try:
- return direct_to_template(request, template="about/%s.html" % page)
- except TemplateDoesNotExist:
- raise Http404()
新闻热点
疑难解答