Add back support for individual database settings
Added for compatibility with version 3.2 settings. These are now a fallback if the new 'DATABASES' setting is not specified. Signed-off-by: Roberto Rosario <roberto.rosario@mayan-edms.com>
This commit is contained in:
@@ -134,6 +134,10 @@
|
|||||||
- Add document trashed event. Closes GitLab issue #608
|
- Add document trashed event. Closes GitLab issue #608
|
||||||
Thanks to Vikas Kedia (@vikaskedia) for the report.
|
Thanks to Vikas Kedia (@vikaskedia) for the report.
|
||||||
- Add transaction handling to document model events.
|
- Add transaction handling to document model events.
|
||||||
|
- Add back support for individual database settings
|
||||||
|
for compatibility with version 3.2 settings.
|
||||||
|
These are now a fallback if the new 'DATABASES'
|
||||||
|
setting is not specified.
|
||||||
|
|
||||||
3.2.10 (2019-XX-XX)
|
3.2.10 (2019-XX-XX)
|
||||||
===================
|
===================
|
||||||
|
|||||||
@@ -9,6 +9,13 @@ BOOTSTRAP_SETTING_LIST = (
|
|||||||
{'name': 'COMMON_EXTRA_APPS'},
|
{'name': 'COMMON_EXTRA_APPS'},
|
||||||
{'name': 'DATA_UPLOAD_MAX_MEMORY_SIZE'},
|
{'name': 'DATA_UPLOAD_MAX_MEMORY_SIZE'},
|
||||||
{'name': 'DATABASES'},
|
{'name': 'DATABASES'},
|
||||||
|
{'name': 'DATABASE_ENGINE'},
|
||||||
|
{'name': 'DATABASE_NAME'},
|
||||||
|
{'name': 'DATABASE_USER'},
|
||||||
|
{'name': 'DATABASE_PASSWORD'},
|
||||||
|
{'name': 'DATABASE_HOST'},
|
||||||
|
{'name': 'DATABASE_PORT'},
|
||||||
|
{'name': 'DATABASE_CONN_MAX_AGE'},
|
||||||
{'name': 'DEBUG', 'default': 'false'},
|
{'name': 'DEBUG', 'default': 'false'},
|
||||||
{'name': 'DEFAULT_FROM_EMAIL'},
|
{'name': 'DEFAULT_FROM_EMAIL'},
|
||||||
{'name': 'DISALLOWED_USER_AGENTS'},
|
{'name': 'DISALLOWED_USER_AGENTS'},
|
||||||
|
|||||||
+46
-10
@@ -328,14 +328,6 @@ SWAGGER_SETTINGS = {
|
|||||||
|
|
||||||
AJAX_REDIRECT_CODE = 278
|
AJAX_REDIRECT_CODE = 278
|
||||||
|
|
||||||
# ----- Database -----
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
|
||||||
'NAME': os.path.join(MEDIA_ROOT, 'db.sqlite3'),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BASE_INSTALLED_APPS = INSTALLED_APPS
|
BASE_INSTALLED_APPS = INSTALLED_APPS
|
||||||
COMMON_EXTRA_APPS = ()
|
COMMON_EXTRA_APPS = ()
|
||||||
COMMON_DISABLED_APPS = ()
|
COMMON_DISABLED_APPS = ()
|
||||||
@@ -358,9 +350,32 @@ if 'revertsettings' not in sys.argv:
|
|||||||
|
|
||||||
for setting in BOOTSTRAP_SETTING_LIST:
|
for setting in BOOTSTRAP_SETTING_LIST:
|
||||||
if setting['name'] in configuration_result:
|
if setting['name'] in configuration_result:
|
||||||
globals().update({setting['name']: configuration_result[setting['name']]})
|
globals().update(
|
||||||
|
{setting['name']: configuration_result[setting['name']]}
|
||||||
|
)
|
||||||
elif setting['name'] in environment_result:
|
elif setting['name'] in environment_result:
|
||||||
globals().update({setting['name']: environment_result[setting['name']]})
|
globals().update(
|
||||||
|
{setting['name']: environment_result[setting['name']]}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Apply the default only if it has not yet been defined previously
|
||||||
|
# in this module.
|
||||||
|
if setting['name'] not in globals():
|
||||||
|
globals().update(
|
||||||
|
{
|
||||||
|
setting['name']: get_environment_setting(
|
||||||
|
name=setting['name']
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
# Safe fallback to allow the revertsettings command to complete.
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(MEDIA_ROOT, 'db.sqlite3'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for app in INSTALLED_APPS:
|
for app in INSTALLED_APPS:
|
||||||
@@ -378,3 +393,24 @@ for APP in (COMMON_EXTRA_APPS or ()):
|
|||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
APP for APP in INSTALLED_APPS if APP not in (COMMON_DISABLED_APPS or ())
|
APP for APP in INSTALLED_APPS if APP not in (COMMON_DISABLED_APPS or ())
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if not DATABASES:
|
||||||
|
if DATABASE_ENGINE:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': DATABASE_ENGINE,
|
||||||
|
'NAME': DATABASE_NAME,
|
||||||
|
'USER': DATABASE_USER,
|
||||||
|
'PASSWORD': DATABASE_PASSWORD,
|
||||||
|
'HOST': DATABASE_HOST,
|
||||||
|
'PORT': DATABASE_PORT,
|
||||||
|
'CONN_MAX_AGE': DATABASE_CONN_MAX_AGE
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else:
|
||||||
|
DATABASES = {
|
||||||
|
'default': {
|
||||||
|
'ENGINE': 'django.db.backends.sqlite3',
|
||||||
|
'NAME': os.path.join(MEDIA_ROOT, 'db.sqlite3'),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user