From df6f2641cc091134170cdb320ebd19756e3fe70f Mon Sep 17 00:00:00 2001 From: Kotiuk Nazarii Date: Fri, 15 May 2015 00:53:11 +0300 Subject: [PATCH] Cache templates loading --- proj/settings.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/proj/settings.py b/proj/settings.py index c1c02a3d..a828c6bc 100644 --- a/proj/settings.py +++ b/proj/settings.py @@ -115,12 +115,6 @@ STATICFILES_FINDERS = ( SECRET_KEY = '=yz1@ko%1s8bmel)c84#s*xpxn%4(1e+smdnh*@rdm*5%v!mln' -TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', -# 'django.template.loaders.eggs.Loader', -) - TEMPLATE_CONTEXT_PROCESSORS = ( "django.contrib.auth.context_processors.auth", "django.core.context_processors.debug", @@ -416,6 +410,20 @@ except ImportError, e: pass +if not DEBUG: + # cache template loading + TEMPLATE_LOADERS = ( + ('django.template.loaders.cached.Loader', ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + )), + ) +else: + TEMPLATE_LOADERS = ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + ) + # debug_toolbar settings """ if DEBUG: