Django urls straight to html template

Viewed 36053

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 very limited dynamic elements do you go ahead and write a new line in my urls.py file for each page? or is their some neat way to say map all * *.html to the relevant .html file directly?

In general even if it does require a view will I have to write a new line in the url.py file for every page?

6 Answers

Slight Changes for latest versions of Django.

from django.views.generic.base import TemplateView

urlpatterns = [
 path('',TemplateView.as_view(template_name='index.html'), name='home'),
]
Related