[Django]-Django equivalent of Rails application.html.erb?

6👍

In Django, the best practise is to use three levels of template using template inheritance.

I quote the django book to explain you:

You can use as many levels of inheritance as needed. One common way of
using inheritance is the following three-level approach:

  1. Create a base.html template that holds the main look and feel of
    your site. This is the stuff that rarely, if ever, changes.
  2. Create a base_SECTION.html template for each “section” of your site
    (e.g., base_photos.html and base_forum.html). These templates
    extend base.html and include section-specific styles/design.
  3. Create individual templates for each type of page, such as a forum
    page or a photo gallery. These templates extend the
    appropriate section template.

This approach maximizes code reuse and makes it easy to add items to
shared areas, such as section-wide navigation.

👤antoyo

Leave a comment