Django provides a convenient and powerful API for loading templates from the filesystem, with the goal of removing redundancy both in your template-loading calls and in your templates themselves. In order to use this template-loading API, first you'll need to tell the framework where you store your templates. The place to do this is in your settings file—the settings.py
file that I mentioned last chapter, when I introduced the ROOT_URLCONF
setting. If you're following along, open your settings.py
and find the TEMPLATES
setting. It's a list of configurations, one for each engine:
TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { # ... some options here ... }, }, ]
BACKEND
is a dotted Python path to a template engine class implementing Django's template backend API. The built-in backends...