Ensure default database name is set

Closes #279
This commit is contained in:
Christopher C. Wells 2021-08-06 14:28:45 -07:00
parent 5598482d53
commit 359846fe57
1 changed files with 4 additions and 3 deletions

View File

@ -101,9 +101,10 @@ TEMPLATES = [
# Database
# https://docs.djangoproject.com/en/3.0/ref/settings/#databases
config = {'ENGINE': os.getenv('DB_ENGINE') or 'django.db.backends.sqlite3'}
if os.getenv('DB_NAME'):
config['NAME'] = os.getenv('DB_NAME')
config = {
'ENGINE': os.getenv('DB_ENGINE') or 'django.db.backends.sqlite3',
'NAME': os.getenv('DB_NAME') or 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'):