mirror of https://github.com/snachodog/mybuddy.git
parent
858436e840
commit
ddf4c70739
|
@ -101,12 +101,19 @@ TEMPLATES = [
|
||||||
# Database
|
# Database
|
||||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
||||||
|
|
||||||
DATABASES = {
|
config = {'ENGINE': os.getenv('DB_ENGINE') or 'django.db.backends.sqlite3'}
|
||||||
'default': {
|
if os.getenv('DB_NAME'):
|
||||||
'ENGINE': 'django.db.backends.sqlite3',
|
config['NAME'] = os.getenv('DB_NAME')
|
||||||
'NAME': os.path.join(BASE_DIR, 'data/db.sqlite3'),
|
if os.getenv('DB_USER'):
|
||||||
}
|
config['USER'] = os.getenv('DB_USER')
|
||||||
}
|
if os.environ.get('DB_PASSWORD') or os.environ.get('POSTGRES_PASSWORD'):
|
||||||
|
config['PASSWORD'] = os.environ.get('DB_PASSWORD') or os.environ.get('POSTGRES_PASSWORD')
|
||||||
|
if os.getenv('DB_HOST'):
|
||||||
|
config['HOST'] = os.getenv('DB_HOST')
|
||||||
|
if os.getenv('DB_PORT'):
|
||||||
|
config['PORT'] = os.getenv('DB_PORT')
|
||||||
|
|
||||||
|
DATABASES = {'default': config}
|
||||||
|
|
||||||
|
|
||||||
# Cache
|
# Cache
|
||||||
|
|
|
@ -1,17 +0,0 @@
|
||||||
from .base import *
|
|
||||||
|
|
||||||
|
|
||||||
# Database
|
|
||||||
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
|
|
||||||
|
|
||||||
# Load settings from env file / variables with fallback defaults to support current psql deployment
|
|
||||||
DATABASES = {
|
|
||||||
'default': {
|
|
||||||
'ENGINE': os.getenv('DB_ENGINE') or 'django.db.backends.postgresql_psycopg2',
|
|
||||||
'NAME': os.getenv('DB_NAME') or 'postgres',
|
|
||||||
'USER': os.getenv('DB_USER') or 'postgres',
|
|
||||||
'PASSWORD': os.environ.get('DB_PASSWORD') or os.environ.get('POSTGRES_PASSWORD'),
|
|
||||||
'HOST': os.getenv('DB_HOST') or 'db',
|
|
||||||
'PORT': os.getenv('DB_PORT') or 5432,
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue