#25788: Enable the cached template loader when DEBUG=False if no loaders are
explicitly configured
---------------------------------+------------------------------------
Reporter: jaap3 | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
---------------------------------+------------------------------------
Changes (by timgraham):
* has_patch: 1 => 0
* stage: Someday/Maybe => Accepted
Comment:
Aymeric suggested to enable the cached template loader by default when
`DEBUG = False` and no `‘loaders’` options is specified.
This is technically backwards-incompatible, but:
- people who don’t usually configure it will get a free performance boost
in production
- people who do will be able to simplify their configurations
Currently many projects have a variant of this awful pattern:
{{{
# settings/prod.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'OPTIONS': {
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.app_directories.Loader',
]),
],
},
},
]
# settings/dev.py
from .prod import *
TEMPLATES[0]['OPTIONS'].update({
'loaders': [
'django.template.loaders.app_directories.Loader',
],
})
}}}
His suggestion makes it possible to remove the configuration of
`‘loaders’` and to rely only on `DIRS` and `APP_DIRS` instead.
--
Ticket URL: <https://code.djangoproject.com/ticket/25788#comment:3>
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/063.77085d7007cca4976183184405a0a6ec%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.