Permalink
Browse files

Fixed #18617 -- Highlighted that the app_directories template loader …

…depends on the order of INSTALLED_APPS.

Thanks evildmp for the patch.
  • Loading branch information...
1 parent e806f04 commit 8c670ee34714acffbc64e5cafd1e664fb8341a37 @aaugustin aaugustin committed Jul 12, 2012
Showing with 15 additions and 5 deletions.
  1. +15 −5 docs/ref/templates/api.txt
View
@@ -649,14 +649,24 @@ class. Here are the template loaders that come with Django:
INSTALLED_APPS = ('myproject.polls', 'myproject.music')
- ...then ``get_template('foo.html')`` will look for templates in these
+ ...then ``get_template('foo.html')`` will look for ``foo.html`` in these
directories, in this order:
- * ``/path/to/myproject/polls/templates/foo.html``
- * ``/path/to/myproject/music/templates/foo.html``
+ * ``/path/to/myproject/polls/templates/``
+ * ``/path/to/myproject/music/templates/``
- Note that the loader performs an optimization when it is first imported: It
- caches a list of which :setting:`INSTALLED_APPS` packages have a
+ ... and will use the one it finds first.
+
+ The order of :setting:`INSTALLED_APPS` is significant! For example, if you
+ want to customize the Django admin, you might choose to override the
+ standard ``admin/base_site.html`` template, from ``django.contrib.admin``,
+ with your own ``admin/base_site.html`` in ``myproject.polls``. You must
+ then make sure that your ``myproject.polls`` comes *before*
+ ``django.contrib.admin`` in :setting:`INSTALLED_APPS`, otherwise
+ ``django.contrib.admin``'s will be loaded first and yours will be ignored.
+
+ Note that the loader performs an optimization when it is first imported:
+ it caches a list of which :setting:`INSTALLED_APPS` packages have a
``templates`` subdirectory.
This loader is enabled by default.

0 comments on commit 8c670ee

Please sign in to comment.