From 8142d62f37bb52bf29e025524c0c7ed7496c90da Mon Sep 17 00:00:00 2001 From: Kumi Date: Mon, 4 Dec 2023 16:35:23 +0100 Subject: [PATCH] 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. --- expalert/settings.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/expalert/settings.py b/expalert/settings.py index a73398a..a3ad074 100644 --- a/expalert/settings.py +++ b/expalert/settings.py @@ -71,15 +71,15 @@ WSGI_APPLICATION = 'expalert.wsgi.application' # Database # 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 = { 'default': { 'ENGINE': 'django.db.backends.mysql', - 'NAME': CONFIG.get(dbtype, "Database"), - 'USER': CONFIG.get(dbtype, "Username"), - 'PASSWORD': CONFIG.get(dbtype, "Password"), - 'HOST': CONFIG.get(dbtype, "Host", fallback="localhost"), - 'PORT': CONFIG.getint(dbtype, "Port", fallback=3306) + 'NAME': SETTINGS.get(dbtype, "Database"), + 'USER': SETTINGS.get(dbtype, "Username"), + 'PASSWORD': SETTINGS.get(dbtype, "Password"), + 'HOST': SETTINGS.get(dbtype, "Host", fallback="localhost"), + 'PORT': SETTINGS.getint(dbtype, "Port", fallback=3306) } }