Fixed #27598 -- Allowed specifying directories for a filesystem template loader.

Thanks Carl Meyer for review.
This commit is contained in:
Tim Graham 2016-12-13 16:50:00 -05:00
parent 7da37699e8
commit 92c5eeac33
4 changed files with 39 additions and 1 deletions

View file

@ -847,6 +847,26 @@ loaders that come with Django:
'DIRS': [os.path.join(BASE_DIR, 'templates')],
}]
You can also override ``'DIRS'`` and specify specific directories for a
particular filesystem loader::
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {
'loaders': [
(
'django.template.loaders.filesystem.Loader',
[os.path.join(BASE_DIR, 'templates')],
),
],
},
}]
.. versionchanged:: 1.11
The ability to specify directories for a particular filesystem loader
was added.
``django.template.loaders.app_directories.Loader``
.. class:: app_directories.Loader