From e6a9bc34ac76fced9c3faa3652691c16aa63d735 Mon Sep 17 00:00:00 2001 From: Evan Callicoat Date: Tue, 10 Mar 2015 16:00:05 -0500 Subject: [PATCH] Enable offline compression for resource files The default value for OFFLINE_COMPRESS is False, as per the Django compressor docs. When using offline compression, it seems that different request contexts may generate different CSS files with different names by way of the SCSS generator. When the HTML is returned to the browser, the CSS filename referenced will only exist on the node that received the initial request and generated the CSS file locally, however in a load-balanced scenario with multiple Horizon instances, the actual HTTP request for the CSS file has a n-1/n chance of hitting another node that may be lacking that file, resulting in an unstyled page. Changing the OFFLINE_COMPRESS value to True enables Django to use the pre-generated list of resources -- created via the manage.py compress command -- which is stored in a manifest.json file and should be the same name/content across the instances since it's not varying by request context like during online compression. Change-Id: Iccb9b8cd30b7a61435f9ccc813c4032a24cbe52a Closes-Bug: #1423783 --- .../roles/os_horizon/templates/horizon_local_settings.py.j2 | 1 + 1 file changed, 1 insertion(+) diff --git a/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 b/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 index 54192db98c..ad87cb6f75 100644 --- a/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 +++ b/playbooks/roles/os_horizon/templates/horizon_local_settings.py.j2 @@ -4,6 +4,7 @@ from openstack_dashboard import exceptions DEBUG = {{ debug }} TEMPLATE_DEBUG = DEBUG +COMPRESS_OFFLINE = True COMPRESS_ENABLED = True COMPRESS_ROOT = '{{ horizon_lib_dir }}/static'