From 457972c1c66b576a9a3a1efd2809f3a21e6ddd03 Mon Sep 17 00:00:00 2001 From: Rob Cresswell Date: Thu, 3 Dec 2015 13:50:26 +0000 Subject: [PATCH] Add Cached loader for templates This patch adds the cached template loader to our TEMPLATE_LOADERS setting. Change-Id: I44bb13dfb2868c857112483c1ad09a181121b58c Implements: blueprint cache-templates --- openstack_dashboard/settings.py | 8 +++++--- .../notes/bp-cache-templates-4ab00dcda195a03a.yaml | 8 ++++++++ 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/bp-cache-templates-4ab00dcda195a03a.yaml diff --git a/openstack_dashboard/settings.py b/openstack_dashboard/settings.py index a87729055..b359adb5a 100644 --- a/openstack_dashboard/settings.py +++ b/openstack_dashboard/settings.py @@ -127,9 +127,11 @@ TEMPLATE_CONTEXT_PROCESSORS = ( ) TEMPLATE_LOADERS = ( - 'django.template.loaders.filesystem.Loader', - 'django.template.loaders.app_directories.Loader', - 'horizon.loaders.TemplateLoader', + ('django.template.loaders.cached.Loader', ( + 'django.template.loaders.filesystem.Loader', + 'django.template.loaders.app_directories.Loader', + 'horizon.loaders.TemplateLoader', + )), ) TEMPLATE_DIRS = ( diff --git a/releasenotes/notes/bp-cache-templates-4ab00dcda195a03a.yaml b/releasenotes/notes/bp-cache-templates-4ab00dcda195a03a.yaml new file mode 100644 index 000000000..d885328ac --- /dev/null +++ b/releasenotes/notes/bp-cache-templates-4ab00dcda195a03a.yaml @@ -0,0 +1,8 @@ +--- +features: + - Added the Django template cached loader, so templates are stored in memory. + See https://docs.djangoproject.com/en/1.8/ref/templates/api/#django.template.loaders.cached.Loader +upgrade: + - Custom template tags must have a thread-safe Node implementation to work + with the the cached loader. See + https://docs.djangoproject.com/en/1.8/howto/custom-template-tags/#template-tag-thread-safety