diff --git a/leadsdb/settings.py b/leadsdb/settings.py index 2ebd1eb..4ad7e93 100644 --- a/leadsdb/settings.py +++ b/leadsdb/settings.py @@ -10,20 +10,25 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/4.2/ref/settings/ """ +import os from pathlib import Path +from dotenv import load_dotenv +import dj_database_url # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent +# Load environment variables from .env file +load_dotenv(BASE_DIR / '.env') # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/4.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-your-secret-key-here' +SECRET_KEY = os.environ.get('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +DEBUG = os.environ.get('DEBUG', 'False') == 'True' ALLOWED_HOSTS = [] @@ -76,10 +81,7 @@ WSGI_APPLICATION = 'leadsdb.wsgi.application' # https://docs.djangoproject.com/en/4.2/ref/settings/#databases DATABASES = { - 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } + 'default': dj_database_url.config(default=os.environ.get('DATABASE_URL')) }