forked from orbit-oss/flask
Added EXPLAIN_TEMPLATE_LOADING to help people debug templates not being loaded.
This commit is contained in:
parent
f17ad953dd
commit
bafc139810
11 changed files with 172 additions and 17 deletions
|
|
@ -185,6 +185,24 @@ want to render the template ``'admin/index.html'`` and you have provided
|
|||
``templates`` as a `template_folder` you will have to create a file like
|
||||
this: ``yourapplication/admin/templates/admin/index.html``.
|
||||
|
||||
To further reiterate this: if you have a blueprint named ``admin`` and you
|
||||
want to render a template called ``index.html`` which is specific to this
|
||||
blueprint, the best idea is to lay out your templates like this::
|
||||
|
||||
yourpackage/
|
||||
blueprints/
|
||||
admin/
|
||||
templates/
|
||||
admin/
|
||||
index.html
|
||||
__init__.py
|
||||
|
||||
And then when you want to render the template, use ``admin/index.html`` as
|
||||
the name to look up the template by. If you encounter problems loading
|
||||
the correct templates enable the ``EXPLAIN_TEMPLATE_LOADING`` config
|
||||
variable which will instruct Flask to print out the steps it goes through
|
||||
to locate templates on every ``render_template`` call.
|
||||
|
||||
Building URLs
|
||||
-------------
|
||||
|
||||
|
|
|
|||
|
|
@ -188,6 +188,13 @@ The following configuration values are used internally by Flask:
|
|||
be viable to disable this feature by setting
|
||||
this key to ``False``. This option does not
|
||||
affect debug mode.
|
||||
``EXPLAIN_TEMPLATE_LOADING`` If this is enabled then every attempt to
|
||||
load a template will write an info
|
||||
message to the logger explaining the
|
||||
attempts to locate the template. This
|
||||
can be useful to figure out why
|
||||
templates cannot be found or wrong
|
||||
templates appear to be loaded.
|
||||
================================= =========================================
|
||||
|
||||
.. admonition:: More on ``SERVER_NAME``
|
||||
|
|
@ -234,10 +241,8 @@ The following configuration values are used internally by Flask:
|
|||
``JSON_AS_ASCII``, ``JSON_SORT_KEYS``, ``JSONIFY_PRETTYPRINT_REGULAR``
|
||||
|
||||
.. versionadded:: 1.0
|
||||
``SESSION_REFRESH_EACH_REQUEST``
|
||||
|
||||
.. versionadded:: 1.0
|
||||
``TEMPLATES_AUTO_RELOAD``, ``LOGGER_HANDLER_POLICY``
|
||||
``SESSION_REFRESH_EACH_REQUEST``, ``TEMPLATES_AUTO_RELOAD``,
|
||||
``LOGGER_HANDLER_POLICY``, ``EXPLAIN_TEMPLATE_LOADING``
|
||||
|
||||
Configuring from Files
|
||||
----------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue