diff --git a/shiftregister/settings.py b/shiftregister/settings.py index ac68733..02436bd 100644 --- a/shiftregister/settings.py +++ b/shiftregister/settings.py @@ -11,6 +11,7 @@ https://docs.djangoproject.com/en/4.0/ref/settings/ """ from pathlib import Path +from os import getenv # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -20,12 +21,12 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/4.0/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-pdgzgd_!w&&cfqc%r&!v_^6pgf!sza=2wim67()!(kaf7_6-5)' +SECRET_KEY = getenv('SECRET_KEY', 'django-insecure-pdgzgd_!w&&cfqc%r&!v_^6pgf!sza=2wim67()!(kaf7_6-5)') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = getenv('ENVIRONMENT', 'development') == 'production' -ALLOWED_HOSTS = [] +ALLOWED_HOSTS = getenv('ALLOWED_HOSTS', '').split(',') # Application definition @@ -77,8 +78,12 @@ WSGI_APPLICATION = 'shiftregister.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', + 'ENGINE': 'django.db.backends.'+getenv('DB_ENGINE', 'sqlite3'), + 'NAME': getenv('DB_NAME', BASE_DIR / 'db.sqlite3'), + 'USER': getenv('DB_USER', ''), + 'PASSWORD': getenv('DB_PASSWORD', ''), + 'HOST': getenv('DB_HOST', ''), + 'PORT': getenv('DB_PORT', ''), } } @@ -105,7 +110,7 @@ AUTH_PASSWORD_VALIDATORS = [ # Internationalization # https://docs.djangoproject.com/en/4.0/topics/i18n/ -LANGUAGE_CODE = 'en-us' +LANGUAGE_CODE = 'de-de' TIME_ZONE = 'Europe/Berlin'