Template loading

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 ... }, ...

Get Mastering Django: Core now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.