I followed the Django “first app” tutorial, and now I am wondering how I could write templates that the whole site will use. I can write the templates for each view, but how do I write a template that will be on every page and then include the ‘sub templates’ in say a ‘content block’?
Share
See the Template Inheritance section of the Django template docs.
Basically, you create one template that is the “base”:
and save it as (for example) “base.html” in your template directory, then each specific page template looks like: