summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-12-17 22:10:57 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-12-28 17:02:30 +0100
commitcf0fd65ed42d5d4f0585da413db4b1cf7c6b0d1a (patch)
tree3f4f652525adf16178018e4ce0c7eddeb0f61360 /docs/ref
parentd3a982556d655adcf4ba331d2def685d8249170f (diff)
Deprecated TEMPLATE_LOADERS.
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/contrib/admin/index.txt5
-rw-r--r--docs/ref/contrib/sitemaps.txt6
-rw-r--r--docs/ref/settings.txt5
-rw-r--r--docs/ref/templates/api.txt66
4 files changed, 57 insertions, 25 deletions
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index a6a315cc88..55dfe08f17 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -2337,8 +2337,9 @@ directory.
In order to override one or more of them, first create an ``admin`` directory
in your project's ``templates`` directory. This can be any of the directories
-you specified in :setting:`TEMPLATE_DIRS`. If you have customized the
-:setting:`TEMPLATE_LOADERS` setting, be sure
+you specified in the :setting:`DIRS <TEMPLATES-DIRS>` option of the
+``DjangoTemplates`` backend in the :setting:`TEMPLATES` setting. If you have
+customized the ``'loaders'`` option, be sure
``'django.template.loaders.filesystem.Loader'`` appears before
``'django.template.loaders.app_directories.Loader'`` so that your custom
templates will be found by the template loading system before those that are
diff --git a/docs/ref/contrib/sitemaps.txt b/docs/ref/contrib/sitemaps.txt
index 8279d8e93e..b28b9b463d 100644
--- a/docs/ref/contrib/sitemaps.txt
+++ b/docs/ref/contrib/sitemaps.txt
@@ -34,9 +34,9 @@ To install the sitemap app, follow these steps:
1. Add ``'django.contrib.sitemaps'`` to your :setting:`INSTALLED_APPS`
setting.
-2. Make sure ``'django.template.loaders.app_directories.Loader'``
- is in your :setting:`TEMPLATE_LOADERS` setting. It's in there by default,
- so you'll only need to change this if you've changed that setting.
+2. Make sure your :setting:`TEMPLATES` setting contains a ``DjangoTemplates``
+ backend whose ``APP_DIRS`` options is set to ``True``. It's in there by
+ default, so you'll only need to change this if you've changed that setting.
3. Make sure you've installed the
:mod:`sites framework <django.contrib.sites>`.
diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt
index dd01e9e1cd..ae387023e7 100644
--- a/docs/ref/settings.txt
+++ b/docs/ref/settings.txt
@@ -2439,6 +2439,11 @@ Default::
('django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader')
+.. deprecated:: 1.8
+
+ Set the ``'loaders'`` option in the :setting:`OPTIONS <TEMPLATES-OPTIONS>`
+ of a ``DjangoTemplates`` backend instead.
+
A tuple of template loader classes, specified as strings. Each ``Loader`` class
knows how to import templates from a particular source. Optionally, a tuple can be
used instead of a string. The first item in the tuple should be the ``Loader``’s
diff --git a/docs/ref/templates/api.txt b/docs/ref/templates/api.txt
index 5aacb2bc09..7ab29ab276 100644
--- a/docs/ref/templates/api.txt
+++ b/docs/ref/templates/api.txt
@@ -734,9 +734,10 @@ with a few other template loaders, which know how to load templates from other
sources.
Some of these other loaders are disabled by default, but you can activate them
-by editing your :setting:`TEMPLATE_LOADERS` setting. :setting:`TEMPLATE_LOADERS`
-should be a tuple of strings or tuples, where each represents a template loader
-class. Here are the template loaders that come with Django:
+by adding a ``'loaders'`` option to your ``DjangoTemplates`` backend in the
+:setting:`TEMPLATES` setting. ``'loaders'`` should be a list of strings or
+tuples, where each represents a template loader class. Here are the template
+loaders that come with Django:
.. currentmodule:: django.template.loaders
@@ -744,8 +745,16 @@ class. Here are the template loaders that come with Django:
.. class:: filesystem.Loader
- Loads templates from the filesystem, according to :setting:`TEMPLATE_DIRS`.
- This loader is enabled by default.
+ Loads templates from the filesystem, according to
+ :setting:`DIRS <TEMPLATES-DIRS>`.
+
+ This loader is enabled by default. However it won't find any templates
+ until you set :setting:`DIRS <TEMPLATES-DIRS>` to a non-empty list::
+
+ TEMPLATES = [{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [os.path.join(BASE_DIR, 'templates')],
+ }]
``django.template.loaders.app_directories.Loader``
@@ -782,7 +791,14 @@ class. Here are the template loaders that come with Django:
it caches a list of which :setting:`INSTALLED_APPS` packages have a
``templates`` subdirectory.
- This loader is enabled by default.
+ This loader is enabled if and only if :setting:`APP_DIRS
+ <TEMPLATES-APP_DIRS>` is set::
+
+ TEMPLATES = [{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'APP_DIRS': True,
+ }]
+
``django.template.loaders.eggs.Loader``
@@ -810,12 +826,18 @@ class. Here are the template loaders that come with Django:
For example, to enable template caching with the ``filesystem`` and
``app_directories`` template loaders you might use the following settings::
- TEMPLATE_LOADERS = (
- ('django.template.loaders.cached.Loader', (
- 'django.template.loaders.filesystem.Loader',
- 'django.template.loaders.app_directories.Loader',
- )),
- )
+ TEMPLATES = [{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'DIRS': [os.path.join(BASE_DIR, 'templates')],
+ 'OPTIONS': {
+ 'loaders': [
+ ('django.template.loaders.cached.Loader', (
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
+ )),
+ ],
+ },
+ }]
.. note::
@@ -838,17 +860,21 @@ class. Here are the template loaders that come with Django:
This loader takes a dictionary of templates as its first argument::
- TEMPLATE_LOADERS = (
- ('django.template.loaders.locmem.Loader', {
- 'index.html': 'content here',
- }),
- )
+ TEMPLATES = [{
+ 'BACKEND': 'django.template.backends.django.DjangoTemplates',
+ 'OPTIONS': {
+ 'loaders': [
+ ('django.template.loaders.locmem.Loader', {
+ 'index.html': 'content here',
+ }),
+ ],
+ },
+ }]
This loader is disabled by default.
-Django uses the template loaders in order according to the
-:setting:`TEMPLATE_LOADERS` setting. It uses each loader until a loader finds a
-match.
+Django uses the template loaders in order according to the ``'loaders'``
+option. It uses each loader until a loader finds a match.
.. currentmodule:: django.template