diff --git a/CTOAsYouGo/CTOAsYouGo/__pycache__/settings.cpython-310.pyc b/CTOAsYouGo/CTOAsYouGo/__pycache__/settings.cpython-310.pyc index 380088d..759b27a 100644 Binary files a/CTOAsYouGo/CTOAsYouGo/__pycache__/settings.cpython-310.pyc and b/CTOAsYouGo/CTOAsYouGo/__pycache__/settings.cpython-310.pyc differ diff --git a/CTOAsYouGo/CTOAsYouGo/settings.py b/CTOAsYouGo/CTOAsYouGo/settings.py index b0e7315..31c6ae3 100644 --- a/CTOAsYouGo/CTOAsYouGo/settings.py +++ b/CTOAsYouGo/CTOAsYouGo/settings.py @@ -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