Compare commits

...

2 commits

Author SHA1 Message Date
Jannis Portmann
929d61e12c Set debug via env 2023-04-08 12:22:19 +02:00
Jannis Portmann
cd0dba93fb Use postgres if available 2023-04-08 12:21:33 +02:00
2 changed files with 9 additions and 6 deletions

View file

@ -6,7 +6,10 @@ services:
ports:
- 8080:8888
environment:
DOCKER: True
POSTGRES_PASSWORD: development
POSTGRES_USER: pflaenzli
POSTGRES_DB: pflaenzli
DJANGO_DEBUG: true
db:
image: postgres:15

View file

@ -30,7 +30,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
SECRET_KEY = "django-insecure-q=ps#iypevr!3zfpwtfp3lw#4r3%oyj*(2=*iq^8f4_zbodi^("
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
DEBUG = os.getenv('DJANGO_DEBUG') == 'true'
ALLOWED_HOSTS = os.getenv('DJANGO_ALLOWED_HOSTS', '').split(',')
CSRF_TRUSTED_ORIGINS = os.getenv('DJANGO_CSRF_TRUSTED_ORIGINS', '').split(',')
@ -85,13 +85,13 @@ WSGI_APPLICATION = "pflaenzli_django.wsgi.application"
# Database
# https://docs.djangoproject.com/en/4.1/ref/settings/#databases
if os.getenv("DOCKER"):
if os.getenv('POSTGRES_DB') is not None:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'pflaenzli',
'USER': 'pflaenzli',
'PASSWORD': 'development',
'NAME': os.getenv('POSTGRES_DB'),
'USER': os.getenv('POSTGRES_USER'),
'PASSWORD': os.getenv('POSTGRES_PASSWORD'),
'HOST': 'db',
'PORT': '5432',
}