Django urls straight to html template

后端 未结 5 1947
我在风中等你
我在风中等你 2021-02-01 01:58

Learning django & python.

Just set up a new site after doing the tutorial. Now for arguments sake say I want to add a bunch of About us, FAQ basic html pages with ve

5条回答
  •  悲&欢浪女
    2021-02-01 02:57

    As long as there is some uniquely identifying section in the URL, you will not need to create an entry in urls.py for each direct-template url.

    For example, you could say that all urls ending in ".html" are referencing a direct file from the templates.

    urlpatterns = patterns('django.views.generic.simple',
        (r'(.+\.html)$', 'direct_to_template'),
        # ...
    )
    

    Take a look at http://docs.djangoproject.com/en/1.2/ref/generic-views/#django-views-generic-simple-direct-to-template for details.

提交回复
热议问题