Base template

Most of, if not all lithium applications require a base.html template. The base template is just a master template on which every other template of lithium extends on. You can either use the provided templates, or write your own.

Using the default templates

To use the default templates follow these steps:

  1. Paste from lithium import templates_path into your file.

  2. Add templates_path() to the TEMPLATE_DIRS section.


Writing your own base.html template

You will need to create a file called base.html and place it inside a TEMPLATE_DIR.

An example of a base.html template:

<html xmlns="" xml:lang="en">
    <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
    <title>{% block title %}My Website{% endblock %}</title>

    <div id="container">
        <div id="content">
            {% block content %}{% endblock %}

        <div id="sidebar">

What blocks does Lithium use?

Lithium only uses two blocks, title, and content. In the title, it will place the name of a page, the title of it. Inside the content, it will insert the bulk of the page, the information.