Fix database configuration
This commit is contained in:
Binary file not shown.
@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
|
||||
|
||||
from pathlib import Path
|
||||
import os
|
||||
import dj_database_url
|
||||
|
||||
# Build paths inside the project like this: BASE_DIR / 'subdir'.
|
||||
BASE_DIR = Path(__file__).resolve().parent.parent
|
||||
@@ -78,12 +79,17 @@ WSGI_APPLICATION = 'CTOAsYouGo.wsgi.application'
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {
|
||||
if 'DATABASE_URL' in os.environ:
|
||||
DATABASES = {
|
||||
'default': dj_database_url.config()
|
||||
}
|
||||
else:
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
'NAME': BASE_DIR / 'db.sqlite3',
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Password validation
|
||||
|
||||
Reference in New Issue
Block a user