feat: Update Django project settings to use SQLite database and add debugging print statements

This commit is contained in:
Lord_Devi 2024-09-16 21:35:40 -04:00
parent a4545b33f9
commit 95b51e4c6b

View file

@ -12,25 +12,20 @@ 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 = os.environ.get('SECRET_KEY')
SECRET_KEY = 'django-insecure-your-secret-key-here'
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = os.environ.get('DEBUG', 'False') == 'True'
DEBUG = True
ALLOWED_HOSTS = []
ALLOWED_HOSTS = ['localhost', '127.0.0.1']
# Application definition
@ -81,7 +76,10 @@ WSGI_APPLICATION = 'leadsdb.wsgi.application'
# https://docs.djangoproject.com/en/4.2/ref/settings/#databases
DATABASES = {
'default': dj_database_url.config(default=os.environ.get('DATABASE_URL'))
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
@ -125,3 +123,13 @@ STATIC_URL = 'static/'
# https://docs.djangoproject.com/en/4.2/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
# Print the entire settings module for debugging
print("==== START OF SETTINGS ====")
import sys
current_module = sys.modules[__name__]
for name in dir(current_module):
if name.isupper():
value = getattr(current_module, name)
print(f"{name} = {value}")
print("==== END OF SETTINGS ====")