Update database settings and config for testing

This commit is contained in:
Nathan Chapman 2022-11-01 18:14:13 -06:00
parent e14aef1040
commit bfeb3718f5
2 changed files with 17 additions and 18 deletions

View File

@ -5,13 +5,21 @@ load_dotenv()
DEBUG = os.environ.get('DEBUG', 'True') == 'True'
DATABASE_CONFIG = {
'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': {
'service': 'pg_service',
'passfile': '.pgpass'
if DEBUG:
DATABASE_CONFIG = {
'ENGINE': 'django.db.backends.postgresql',
'USER': 'django',
'NAME': 'ptcoffee_dev'
}
}
else:
DATABASE_CONFIG = {
'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': {
'service': 'pg_service',
'passfile': '.pgpass'
}
}
SECRET_KEY = os.environ.get('SECRET_KEY', '')
CACHE_CONFIG = {
'LOCATION': 'redis://127.0.0.1:6379',

View File

@ -99,18 +99,9 @@ WSGI_APPLICATION = 'ptcoffee.wsgi.application'
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
if DEBUG:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'USER': 'django',
'NAME': 'ptcoffee_dev',
},
}
else:
DATABASES = {
'default': DATABASE_CONFIG
}
DATABASES = {
'default': DATABASE_CONFIG
}
CACHES = {'default': CACHE_CONFIG}