From ac4141cbaa2d9fef35c11f86c2fe5aa01de3fe9b Mon Sep 17 00:00:00 2001 From: SKairinos Date: Fri, 27 Sep 2024 15:22:53 +0000 Subject: [PATCH] simplify --- codeforlife/settings/django.py | 41 +++++++++------------------------- manage.py | 2 -- 2 files changed, 10 insertions(+), 33 deletions(-) diff --git a/codeforlife/settings/django.py b/codeforlife/settings/django.py index 2a9e65e..4e3bc4f 100644 --- a/codeforlife/settings/django.py +++ b/codeforlife/settings/django.py @@ -21,38 +21,17 @@ # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases - -def get_databases( # pragma: no cover - name: str = SERVICE_NAME, - host: str = "localhost", - port: int = 5432, - user: str = "root", - password: str = "password", -): - """Get the databases for the Django project. - - Args: - name: The name of the database. - host: The network the database is exposed on. - port: The port of the server the database is exposed on. - user: A registered user on the database server. - password: The password of the database server. - - Returns: - The databases for the django project. - """ - return { - "default": { - "ENGINE": "django.db.backends.postgresql", - "NAME": os.getenv("DB_NAME", name), - "HOST": os.getenv("DB_HOST", host), - "PORT": int(os.getenv("DB_PORT", port)), - "USER": os.getenv("DB_USER", user), - "PASSWORD": os.getenv("DB_PASSWORD", password), - "ATOMIC_REQUESTS": True, - } +DATABASES = { + "default": { + "ENGINE": "django.db.backends.postgresql", + "NAME": os.getenv("DB_NAME", SERVICE_NAME), + "HOST": os.getenv("DB_HOST", "localhost"), + "PORT": int(os.getenv("DB_PORT", "5432")), + "USER": os.getenv("DB_USER", "root"), + "PASSWORD": os.getenv("DB_PASSWORD", "password"), + "ATOMIC_REQUESTS": True, } - +} # Application definition diff --git a/manage.py b/manage.py index cff1c58..260a80e 100644 --- a/manage.py +++ b/manage.py @@ -30,8 +30,6 @@ ROOT_URLCONF = "codeforlife.user.urls" -DATABASES = get_databases() - if __name__ == "__main__": import os import sys