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,6 +5,13 @@ load_dotenv()
DEBUG = os.environ.get('DEBUG', 'True') == 'True' DEBUG = os.environ.get('DEBUG', 'True') == 'True'
if DEBUG:
DATABASE_CONFIG = {
'ENGINE': 'django.db.backends.postgresql',
'USER': 'django',
'NAME': 'ptcoffee_dev'
}
else:
DATABASE_CONFIG = { DATABASE_CONFIG = {
'ENGINE': 'django.db.backends.postgresql', 'ENGINE': 'django.db.backends.postgresql',
'OPTIONS': { 'OPTIONS': {
@ -12,6 +19,7 @@ DATABASE_CONFIG = {
'passfile': '.pgpass' 'passfile': '.pgpass'
} }
} }
SECRET_KEY = os.environ.get('SECRET_KEY', '') SECRET_KEY = os.environ.get('SECRET_KEY', '')
CACHE_CONFIG = { CACHE_CONFIG = {
'LOCATION': 'redis://127.0.0.1:6379', 'LOCATION': 'redis://127.0.0.1:6379',

View File

@ -99,15 +99,6 @@ WSGI_APPLICATION = 'ptcoffee.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases # 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 = { DATABASES = {
'default': DATABASE_CONFIG 'default': DATABASE_CONFIG
} }