Add STROJNADZOR_DATA_DIR environment variable
This commit is contained in:
parent
6b8e6cf480
commit
e2a8936c6f
1 changed files with 9 additions and 6 deletions
|
|
@ -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.
|
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/
|
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, ...)
|
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
@ -198,7 +201,7 @@ DATABASES = {
|
||||||
"CONN_MAX_AGE": 0,
|
"CONN_MAX_AGE": 0,
|
||||||
"ENGINE": "django.db.backends.sqlite3",
|
"ENGINE": "django.db.backends.sqlite3",
|
||||||
"HOST": "localhost",
|
"HOST": "localhost",
|
||||||
"NAME": "project.db",
|
"NAME": os.path.join(DATA_DIR, "project.db"),
|
||||||
"PASSWORD": "",
|
"PASSWORD": "",
|
||||||
"PORT": "",
|
"PORT": "",
|
||||||
"USER": "",
|
"USER": "",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue