#25788: Enabling the cached template loader should be easier
---------------------------------+--------------------
Reporter: jaap3 | Owner: nobody
Type: New feature | Status: new
Component: Template system | Version: master
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Easy pickings: 0 | UI/UX: 0
---------------------------------+--------------------
Currently enabling the cached template loader is a lot of effort, you'll
have to change your settings from something like this:
{{{
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True
}]
}}}
To this:
{{{
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'OPTIONS': {
'loaders': [
('django.template.loaders.cached.Loader', [
'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.Loader',
]),
],
},
}]
}}}
Making sure you don't forget to take out the `APP_DIRS` option, figuring
out what loaders to use and getting the nesting of tuples and lists just
right.
I propose adding an option the Django template engine called
`cache_templates` to simplify all of this. Making the second example look
more like this:
{{{
TEMPLATES = [{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [os.path.join(BASE_DIR, 'templates')],
'APP_DIRS': True
'OPTIONS': {'cache_templates': DEBUG}
}]
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25788>
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/048.b10a00e062ab4ce2810b0efa24e0907b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.