O'Reilly logo

Web Development with Django Cookbook - Second Edition by Aidas Bendoraitis

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Arranging the base.html template

When you start working on templates, one of the first actions is to create the base.html boilerplate, which will be extended by most of the page templates in your project. In this recipe, we will demonstrate how to create such template for multilingual HTML5 websites with responsiveness in mind.

Tip

Responsive websites are the ones that adapt to the viewport of the device whether the visitor uses desktop browsers, tablets, or phones.

Getting ready

Create the templates directory in your project and set TEMPLATE_DIRS in the settings.

How to do it…

Perform the following steps:

  1. In the root directory of your templates, create a base.html file with the following content:
    {# templates/base.html #} <!DOCTYPE html> {% load i18n ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required