3

Designing a Base Template

Django projects can consist of dozens or hundreds of template files. Sometimes, these files can contain duplicated HTML and CSS code, which affects the project’s maintainability. In this chapter, we introduce the concept of base templates and how they can be used to reduce duplicated template code. We will also improve the look and feel of our application by designing a base template that includes a header and a footer, as well as links to different pages.

In this chapter, we will be covering the following topics:

  • Creating a base template with Bootstrap
  • Updating the Home page to use the base template
  • Updating the About page to use the base template
  • Adding a header section
  • Adding a footer section

In the end, you ...

Get Django 5 for the Impatient - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.