From cff558e7b0d99568fd65e20ddde14c6f567d8a62 Mon Sep 17 00:00:00 2001 From: faucomte97 Date: Mon, 22 Apr 2024 17:49:04 +0100 Subject: [PATCH] fix: Add helper get DB function --- codeforlife/settings/django.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/codeforlife/settings/django.py b/codeforlife/settings/django.py index 47da079..c9b6ad7 100644 --- a/codeforlife/settings/django.py +++ b/codeforlife/settings/django.py @@ -3,6 +3,7 @@ https://docs.djangoproject.com/en/3.2/ref/settings/ """ import os +from pathlib import Path from django.utils.translation import gettext_lazy as _ @@ -18,6 +19,28 @@ # Application definition +# Database +# https://docs.djangoproject.com/en/3.2/ref/settings/#databases + + +def get_databases(base_dir: Path): # pragma: no cover + """Get the databases for the Django project. + + Args: + base_dir: The base directory of the Django project. + + Returns: + The databases for the django project. + """ + return { + "default": { + "ENGINE": "django.db.backends.sqlite3", + "NAME": base_dir / "db.sqlite3", + "ATOMIC_REQUESTS": True, + } + } + + MIDDLEWARE = [ "django.contrib.sessions.middleware.SessionMiddleware", "django.middleware.locale.LocaleMiddleware",