Allow to set custom django settings
Custom settings may be set via the following pillar
structure:
horizon:
server:
django_settings:
SETTING_NAME:
enabled: true
value: 'SETTING_VALUE'
Change-Id: I3f93d02f46143c298b3a2a5ae600beef921d4712
Related-Prod: PROD-25435
diff --git a/README.rst b/README.rst
index f9ead07..fea13b7 100644
--- a/README.rst
+++ b/README.rst
@@ -585,6 +585,20 @@
server:
images_allow_location: True
+Custom django settings.
+Django has a tonn of usefull settings that might be tuned for particular use case.
+Cover them all in templated manner is not possible. This sections shows how to
+configure custom django setting via horizon metadata.
+
+.. code-block:: yaml
+
+ horizon:
+ server:
+ django_settings:
+ CUSTOM_DJANGO_OPTION:
+ enabled: true
+ value: 'value'
+
Upgrades
========
diff --git a/horizon/files/horizon_settings/_django_settings.py b/horizon/files/horizon_settings/_django_settings.py
new file mode 100644
index 0000000..61ecf62
--- /dev/null
+++ b/horizon/files/horizon_settings/_django_settings.py
@@ -0,0 +1,14 @@
+{%- from "horizon/map.jinja" import server with context %}
+
+{%- if server.app is defined %}
+{%- set app = salt['pillar.get']('horizon:server:app:'+app_name) %}
+{%- else %}
+{%- set app = salt['pillar.get']('horizon:server') %}
+{%- endif %}
+
+
+{% for opt,data in app.get('django_settings', {}).iteritems() %}
+ {%- if data.get('enabled', True) %}
+{{ opt }} = {{ data.value }}
+ {%- endif %}
+{%- endfor %}
diff --git a/horizon/files/local_settings/ocata_settings.py b/horizon/files/local_settings/ocata_settings.py
index e5388f0..ab19ac6 100644
--- a/horizon/files/local_settings/ocata_settings.py
+++ b/horizon/files/local_settings/ocata_settings.py
@@ -83,3 +83,4 @@
{% include "horizon/files/horizon_settings/_cinder_settings.py" %}
{% include "horizon/files/horizon_settings/_websso_settings.py" %}
{% include "horizon/files/horizon_settings/_ssl_settings.py" %}
+{% include "horizon/files/horizon_settings/_django_settings.py"%}
diff --git a/horizon/files/local_settings/queens_settings.py b/horizon/files/local_settings/queens_settings.py
index 666e909..b1e647f 100644
--- a/horizon/files/local_settings/queens_settings.py
+++ b/horizon/files/local_settings/queens_settings.py
@@ -82,3 +82,4 @@
{% include "horizon/files/horizon_settings/_cinder_settings.py" %}
{% include "horizon/files/horizon_settings/_websso_settings.py" %}
{% include "horizon/files/horizon_settings/_ssl_settings.py" %}
+{% include "horizon/files/horizon_settings/_django_settings.py"%}