Refactor database config source
Switched database settings to use the centralized SETTINGS variable instead of the previous CONFIG. This ensures consistency across configuration management and aligns with recent changes to the settings infrastructure, facilitating easier adjustments and maintenance of database parameters.
This commit is contained in:
parent
57119dfc4c
commit
8142d62f37
1 changed files with 6 additions and 6 deletions
|
@ -71,15 +71,15 @@ WSGI_APPLICATION = 'expalert.wsgi.application'
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||||
|
|
||||||
if (dbtype := "MySQL") in CONFIG or (dbtype := "MariaDB") in CONFIG:
|
if (dbtype := "MySQL") in SETTINGS or (dbtype := "MariaDB") in SETTINGS:
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.mysql',
|
'ENGINE': 'django.db.backends.mysql',
|
||||||
'NAME': CONFIG.get(dbtype, "Database"),
|
'NAME': SETTINGS.get(dbtype, "Database"),
|
||||||
'USER': CONFIG.get(dbtype, "Username"),
|
'USER': SETTINGS.get(dbtype, "Username"),
|
||||||
'PASSWORD': CONFIG.get(dbtype, "Password"),
|
'PASSWORD': SETTINGS.get(dbtype, "Password"),
|
||||||
'HOST': CONFIG.get(dbtype, "Host", fallback="localhost"),
|
'HOST': SETTINGS.get(dbtype, "Host", fallback="localhost"),
|
||||||
'PORT': CONFIG.getint(dbtype, "Port", fallback=3306)
|
'PORT': SETTINGS.getint(dbtype, "Port", fallback=3306)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue