Unable to include openstack_dashboard.settings in other top-level django settings module

Bug #1271151 reported by Timur Sufiev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Dashboard (Horizon)
Invalid
Undecided
Unassigned

Bug Description

In order to augment openstack_dashboard.settings with specific django application settings (namely, Murano) while editing neither openstack_dashboard.settings (it contains only settings related to vanilla openstack dashboards), nor /etc/openstack_dashoards/local_settings.py (it is for customization by admins) the following scheme was devised. Change DJANGO_SETTINGS_MODULE in Apache config/WSGI python module to 'muranodashboard.settings' which contains all Murano-specific settings and imports openstack_dashboard.settings, which in turn imports local.local_settings. This approach seemed fine until I coded it and ran: it immediately failed with 'ImproperlyConfigured: The SECRET_KEY setting must not be empty.' exception.

After spending some time in debugger, I found out that during 'openstack_dashboard.settings' module evaluation 'django.conf.Settings' class is instantiated and it requires the 'SECRET_KEY' parameter to be present in settings module referenced by DJANGO_SETTINGS_MODULE environment variable (which, in my case is 'muranodashboard.settings'). But if I try to avoid this error and define my own SECRET_KEY in 'muranodashboard.settings', I end up with 2 different SECRET_KEY values (one from muranodashboard.settings, the other hanging somewhere in horizon's machinery from local.local_settings / openstack_dashboard.settings) which is not good either.

This behaviour clearly seems like a bug, because openstack_dashboard.settings shouldn't invoke functions that rely on SECRET_KEY being already defined in DJANGO_SETTINGS_MODULE module.

Revision history for this message
Ana Krivokapić (akrivoka) wrote :

This sounds like a circular dependency, i.e. you are probably importing something in the muranodashboard.settings, which in turn tries to import something from the settings:

http://stackoverflow.com/questions/19128540/django-improperlyconfigured-the-secret-key-setting-must-not-be-empty

Revision history for this message
Timur Sufiev (tsufiev-x) wrote :

Yes, it was my fault - I was importing some module from horizon. instead of openstack_dashboard.

Changed in horizon:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.