diff --git a/src/strojnadzor/settings.py b/src/strojnadzor/settings.py index 3319d1b..28afeda 100644 --- a/src/strojnadzor/settings.py +++ b/src/strojnadzor/settings.py @@ -1,7 +1,3 @@ -import os # isort:skip - -gettext = lambda s: s -DATA_DIR = os.path.dirname(os.path.dirname(os.path.dirname(__file__))) """ Django settings for strojnadzor project. @@ -14,7 +10,14 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/2.2/ref/settings/ """ -import os +import os # isort:skip + +gettext = lambda s: s + +if "STROJNADZOR_DATA_DIR" in os.environ: + DATA_DIR = os.environ["STROJNADZOR_DATA_DIR"] +else: + DATA_DIR = os.getcwd() # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) @@ -198,7 +201,7 @@ DATABASES = { "CONN_MAX_AGE": 0, "ENGINE": "django.db.backends.sqlite3", "HOST": "localhost", - "NAME": "project.db", + "NAME": os.path.join(DATA_DIR, "project.db"), "PASSWORD": "", "PORT": "", "USER": "",