Commit 8c670ee3 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Fixed #18617 -- Highlighted that the app_directories template loader depends...

Fixed #18617 -- Highlighted that the app_directories template loader depends on the order of INSTALLED_APPS.

Thanks evildmp for the patch.
parent e806f047
Loading
Loading
Loading
Loading
+15 −5
Original line number Diff line number Diff line
@@ -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.