diff --git a/.gitignore b/.gitignore index 3352d05..96d5108 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ __pycache__ .venv +.env db.sqlite3 tailwindcss.exe t-style.css diff --git a/django/core/settings.py b/django/core/settings.py index 768ee8d..76882be 100644 --- a/django/core/settings.py +++ b/django/core/settings.py @@ -10,8 +10,9 @@ For the full list of settings and their values, see https://docs.djangoproject.com/en/5.1/ref/settings/ """ -import json +import json, os from pathlib import Path +from dotenv import load_dotenv # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -21,11 +22,17 @@ EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' #TODO: NUR FÜR # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ +# Support env variables from .env file if defined +env_path = load_dotenv(os.path.join(BASE_DIR, '.env')) +load_dotenv(env_path) + # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-#+s307$rxkts=8@+_^i)8)n1b4*y4za1xz!mvv(h@!+n9!mp9)' +#SECRET_KEY = 'django-insecure-#+s307$rxkts=8@+_^i)8)n1b4*y4za1xz!mvv(h@!+n9!mp9)' +SECRET_KEY = os.environ.get('DJANGO_SECRET_KEY', 'django-insecure-&psk#na5l=p3q8_a+-$4w1f^lt3lx1c@d*p4x$ymm_rn7pwb87') # SECURITY WARNING: don't run with debug turned on in production! -DEBUG = True +#DEBUG = True +DEBUG = os.environ.get('DJANGO_DEBUG', '') != 'False' ALLOWED_HOSTS = ['127.0.0.1', 'localhost', '*'] diff --git a/requirements.txt b/requirements.txt index 62bffb8..dd66b92 100644 --- a/requirements.txt +++ b/requirements.txt @@ -6,4 +6,5 @@ pillow~=11.1.0 # Image handling whitenoise~=6.6.0 # Static file serving django-cleanup redis -channels_redis \ No newline at end of file +channels_redis +python-dotenv # Production server safety \ No newline at end of file