diff --git a/docker-compose.yml b/docker-compose.yml index 74566c3..096b89d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,11 +2,11 @@ services: torreta: build: . environment: - DJANGO_SUPERUSER_PASSWORD: "admin" + DJANGO_SUPERUSER_PASSWORD: ${ADMIN_PASSWORD} command: > sh -c "python manage.py migrate && python manage.py collectstatic --no-input && - python manage.py createsuperuser --username "admin" --email=admin@admin.com --noinput + python manage.py createsuperuser --username "${ADMIN_USER}" --email=admin@admin.com --noinput python manage.py runserver 0.0.0.0:4555" volumes: - static:/app/staticfiles diff --git a/requirements.txt b/requirements.txt index d9b8105..c807a8c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -2,3 +2,4 @@ asgiref==3.8.1 Django==5.1.7 sqlparse==0.5.3 tzdata==2025.2 +python-dotenv==1.0.1 diff --git a/torretadeldrac/settings.py b/torretadeldrac/settings.py index 09e65b4..2b9705d 100644 --- a/torretadeldrac/settings.py +++ b/torretadeldrac/settings.py @@ -11,6 +11,9 @@ https://docs.djangoproject.com/en/5.1/ref/settings/ """ import os from pathlib import Path +from dotenv import load_dotenv + +load_dotenv() # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent @@ -20,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = 'django-insecure-7o__%v#^c7@y8$rvma%s_z-jma7xj#5y-en@ll(_zmk3u=sob7' +SECRET_KEY = os.environ.get('SECRET_KEY') # SECURITY WARNING: don't run with debug turned on in production! DEBUG = False @@ -30,7 +33,7 @@ if DEBUG: CSRF_TRUSTED_ORIGINS = ['http://localhost'] else: ALLOWED_HOSTS = ['*'] - CSRF_TRUSTED_ORIGINS = ['http://localhost'] + CSRF_TRUSTED_ORIGINS = ['http://localhost', 'http://torreta.local', 'https://torreta.gerardgascon.com'] # Application definition