Use postgres if available
This commit is contained in:
parent
f177ab165e
commit
cd0dba93fb
2 changed files with 7 additions and 5 deletions
|
@ -6,7 +6,9 @@ services:
|
|||
ports:
|
||||
- 8080:8888
|
||||
environment:
|
||||
DOCKER: True
|
||||
POSTGRES_PASSWORD: development
|
||||
POSTGRES_USER: pflaenzli
|
||||
POSTGRES_DB: pflaenzli
|
||||
|
||||
db:
|
||||
image: postgres:15
|
||||
|
|
|
@ -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',
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue