Fix database configuration

This commit is contained in:
Senad Uka
2023-07-05 20:02:18 +02:00
parent 2ba56e5852
commit 8f04fc01d5
2 changed files with 8 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ https://docs.djangoproject.com/en/4.2/ref/settings/
from pathlib import Path from pathlib import Path
import os import os
import dj_database_url
# Build paths inside the project like this: BASE_DIR / 'subdir'. # Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent BASE_DIR = Path(__file__).resolve().parent.parent
@@ -78,6 +79,11 @@ WSGI_APPLICATION = 'CTOAsYouGo.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases # https://docs.djangoproject.com/en/4.2/ref/settings/#databases
if 'DATABASE_URL' in os.environ:
DATABASES = {
'default': dj_database_url.config()
}
else:
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.sqlite3', 'ENGINE': 'django.db.backends.sqlite3',