#25079: Warn if both TEMPLATES and TEMPLATE_DIRS are defined
-------------------------------------+-------------------------------------
Reporter: danielr | Owner: nobody
Type: | Status: new
Cleanup/optimization |
Component: Template system | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage:
| Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by danielr):
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> Since the addition of the pluggable template backends, the
> `TEMPLATE_DIRS` setting has been deprecated in favour of the `TEMPLATES`
> list of dicts. If `TEMPLATES` is not defined, it will be constructed
> using the value of `TEMPLATE_DIRS`.
>
> However, `TEMPLATES` is created automatically by the default project
> template; and in this case Django does not use the value in
> `TEMPLATE_DIRS`. This means that users following pre-1.8 tutorials (for
> example, the very popular Tango with Django) will be instructed to add
> `TEMPLATE_DIRS` to a settings file that ignores that value, and then will
> be surprised that their templates are not found. This has hit quite a few
> users on StackOverflow, for example:
>
> http://stackoverflow.com/questions/31108314/templatedoesnotexist-error-
> in-django/31109213
> http://stackoverflow.com/questions/30844500/django-templatedoesnotexist-
> error-on-windows-machine
> http://stackoverflow.com/questions/30740700/django-templatedoesnotexist-
> at-home-html
> http://stackoverflow.com/questions/26176267/django-template-loader-cant-
> find-template/30588425#30588425
>
> and so on.
>
> Django should explicitly warn in this case, telling users to move their
> directories settings to `TEMPLATES`.
New description:
Since the addition of the pluggable template backends, the `TEMPLATE_DIRS`
setting has been deprecated in favour of the `TEMPLATES` list of dicts. If
`TEMPLATES` is not defined, it will be constructed using the value of
`TEMPLATE_DIRS`.
However, `TEMPLATES` is created automatically by the default project
template; and in this case Django does not use the value in
`TEMPLATE_DIRS`. This means that users following pre-1.8 tutorials (for
example, the very popular Tango with Django) will be instructed to add
`TEMPLATE_DIRS` to a settings file that ignores that value, and then will
be surprised that their templates are not found. This has hit quite a few
users on StackOverflow, for example:
http://stackoverflow.com/questions/31108314/templatedoesnotexist-error-in-
django/31109213
http://stackoverflow.com/questions/30844500/django-templatedoesnotexist-
error-on-windows-machine
http://stackoverflow.com/questions/30740700/django-templatedoesnotexist-
at-home-html
http://stackoverflow.com/questions/26176267/django-template-loader-cant-
find-template/30588425#30588425
and so on.
Django should explicitly warn in this case, telling users to move their
directories settings to `TEMPLATES`.
PR: https://github.com/django/django/pull/4959
--
--
Ticket URL: <https://code.djangoproject.com/ticket/25079#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.3bd934bee3c37dc086cc5b7b7cd1eb90%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.