Opened 9 years ago
Last modified 8 years ago
#25079 closed Cleanup/optimization
Warn if both TEMPLATES and TEMPLATE_DIRS are defined — at Initial Version
Reported by: | Daniel Roseman | Owned by: | nobody |
---|---|---|---|
Component: | Template system | Version: | 1.8 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Accepted | |
Has patch: | yes | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
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
.