Skip to content
Myr

Mention the template name conflict issue in blueprint templates docs (#1843)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

* Mention the template name conflict issue in docs. In the blueprints templates documentation mention the possible templates name conflict issue re #266 * Mention priorities between blueprints and other rephrasing fixes

authored by RamiC · committed by David Lord · parent bbd6c8c · Browse files · 1 file+15 added−6 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+15 added−6 removed

  • other:+15 added−6 removed

1 file+15 added−6 removed

modified:docs/blueprints.rst+15 added-6 removed
174 unmodified lines
175the `template_folder` parameter to the :class:`Blueprint` constructor::176177 admin = Blueprint('admin', __name__, template_folder='templates')178179As for static files, the path can be absolute or relative to the blueprint180resource folder. The template folder is added to the searchpath of181templates but with a lower priority than the actual application's template182folder. That way you can easily override templates that a blueprint183provides in the actual application.179For static files, the path can be absolute or relative to the blueprint180resource folder. 181182The template folder is added to the search path of templates but with a lower 183priority than the actual application's template folder. That way you can 184easily override templates that a blueprint provides in the actual application. 185This also means that if you don't want a blueprint template to be accidentally186overridden, make sure that no other blueprint or actual application template187has the same relative path. When multiple blueprints provide the same relative188template path the first blueprint registered takes precedence over the others.189190191So if you have a blueprint in the folder ``yourapplication/admin`` and you192want to render the template ``'admin/index.html'`` and you have provided193``templates`` as a `template_folder` you will have to create a file like188this: :file:`yourapplication/admin/templates/admin/index.html`.194this: :file:`yourapplication/admin/templates/admin/index.html`. The reason195for the extra ``admin`` folder is to avoid getting our template overridden196by a template named ``index.html`` in the actual application template197folder. 198199To further reiterate this: if you have a blueprint named ``admin`` and you200want to render a template called :file:`index.html` which is specific to this201blueprint, the best idea is to lay out your templates like this::
47 unmodified lines