Make murano-dashboard using horizon's DATABASE when horizon configured

If horizon config DATABASES, let murano-dashboard using horizon's config,
if not, will set it by murano.

Closes-bug: #1642152
Change-Id: I65c599945754b92be681058611ec9162c6606f14
This commit is contained in:
zhurong 2016-11-16 15:18:07 +08:00 committed by zhurong
parent 30c88ac981
commit 5a1a388fe6

View File

@ -18,14 +18,23 @@ DISPLAY_MURANO_REPO_URL = 'http://apps.openstack.org/#tab=murano-apps'
# Specify a maximum number of limit packages.
# PACKAGES_LIMIT = 100
# Make sure horizon has config the DATABASES, If horizon config use horizon's
# DATABASES, if not, set it by murano.
try:
from openstack_dashboard.settings import DATABASES
DATABASES_CONFIG = DATABASES.has_key('default')
except ImportError:
DATABASES_CONFIG = False
# Set default session backend from browser cookies to database to
# avoid issues with forms during creating applications.
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'murano-dashboard.sqlite',
if not DATABASES_CONFIG:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'murano-dashboard.sqlite',
}
}
}
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
try: