Skip to content

Commit 86c6eff

Browse files
committed
Summary: Cache template loading (speeds up some pages by 20-50 ms),
but only on production since it is really annoying while developing - Legacy-Id: 8969
1 parent 12faa4a commit 86c6eff

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

ietf/settings.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,10 @@ def skip_unreadable_post(record):
148148
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.PickleSerializer'
149149

150150
TEMPLATE_LOADERS = (
151-
'django.template.loaders.filesystem.Loader',
152-
'django.template.loaders.app_directories.Loader',
151+
('django.template.loaders.cached.Loader', (
152+
'django.template.loaders.filesystem.Loader',
153+
'django.template.loaders.app_directories.Loader',
154+
)),
153155
'ietf.dbtemplate.template.Loader',
154156
)
155157

@@ -495,6 +497,9 @@ def skip_unreadable_post(record):
495497
# secret key has been provided elsewhere, not in this file which is
496498
# publicly available, for instance from the source repository.
497499
if SERVER_MODE != 'production':
500+
# stomp out the cached template loader, it's annoying
501+
TEMPLATE_LOADERS = [l for e in TEMPLATE_LOADERS for l in (e[1] if isinstance(e, tuple) and "cached.Loader" in e[0] else (e,))]
502+
498503
CACHES = {
499504
'default': {
500505
'BACKEND': 'django.core.cache.backends.dummy.DummyCache',

0 commit comments

Comments
 (0)