From 15304233d3707cb7de7dd2aebe5c30e57cd26f7f Mon Sep 17 00:00:00 2001 From: Ernesto Rico Schmidt <ernesto@helsinki.at> Date: Fri, 26 Jul 2024 15:29:48 -0400 Subject: [PATCH] feat: use DATABASE_URL for configuraton, default to sqlite --- steering/settings.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/steering/settings.py b/steering/settings.py index 773bf3ca..2d714e25 100644 --- a/steering/settings.py +++ b/steering/settings.py @@ -2,6 +2,7 @@ import os import sys from pathlib import Path +import dj_database_url import ldap from corsheaders.defaults import default_headers from django_auth_ldap.config import LDAPSearch, PosixGroupType @@ -30,16 +31,7 @@ CORS_ALLOW_HEADERS = list(default_headers) + [ "content-disposition", ] -DATABASES = { - "default": { - "ENGINE": f"django.db.backends.{os.getenv('DATABASE_ENGINE', default='sqlite3')}", - "NAME": os.getenv("POSTGRES_DB", default=BASE_DIR / "db.sqlite3"), - "USER": os.getenv("POSTGRES_USER", default="steering"), - "PASSWORD": os.getenv("POSTGRES_PASSWORD", default="aura"), - "HOST": os.getenv("POSTGRES_HOST", default="steering-postgres"), - "PORT": os.getenv("POSTGRES_PORT", default="5432"), - }, -} +DATABASES = {"default": dj_database_url.config(default=f"sqlite:///{BASE_DIR}/db.sqlite3")} TIME_ZONE = os.getenv("TZ", default="Europe/Vienna") LANGUAGE_CODE = os.getenv("LANGUAGE_CODE", default="en-us") -- GitLab