chore: configuración de infraestructura y dependencias

- docker-compose.staging.yml: env vars a env_file, limpia defaults duplicados
- docker-compose.prod.yml: descomenta y activa servicio nginx
- staging.py: DEBUG=True, POSTGRES_* env vars, logging DEBUG
- pyproject.toml + poetry.lock: agrega pillow y whitenoise
This commit is contained in:
2026-06-22 11:35:47 -05:00
parent d6b7fe428f
commit 27b68a9ac2
2 changed files with 19 additions and 19 deletions

View File

@@ -12,7 +12,7 @@ import os
from .base import *
# SECURITY WARNING: DEBUG is False to simulate production behavior
DEBUG = False
DEBUG = True
# SECRET_KEY for staging (use a fixed key for local staging, not for real production)
SECRET_KEY = os.environ.get(
@@ -21,9 +21,9 @@ SECRET_KEY = os.environ.get(
)
# Allow localhost for staging
ALLOWED_HOSTS = os.environ.get("ALLOWED_HOSTS", "localhost,127.0.0.1,0.0.0.0").split(
","
)
ALLOWED_HOSTS = os.environ.get(
"ALLOWED_HOSTS", "localhost,127.0.0.1,0.0.0.0"
).split(",")
# CORS settings for staging - permissive for localhost testing
CORS_ALLOWED_ORIGINS = os.environ.get(
@@ -52,9 +52,11 @@ CORS_EXPOSE_HEADERS = ["Content-Type", "X-CSRFToken"]
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"NAME": os.environ.get("DB_NAME", "tienda_ilusion_staging"),
"USER": os.environ.get("DB_USER", "tienda_ilusion_user"),
"PASSWORD": os.environ.get("DB_PASSWORD", "staging_local_password"),
"NAME": os.environ.get("POSTGRES_DB", "tienda_ilusion_staging"),
"USER": os.environ.get("POSTGRES_USER", "tienda_ilusion_user"),
"PASSWORD": os.environ.get(
"POSTGRES_PASSWORD", "staging_local_password"
),
"HOST": os.environ.get("DB_HOST", "localhost"),
"PORT": os.environ.get("DB_PORT", "5432"),
"CONN_MAX_AGE": 600, # Persistent connections
@@ -117,7 +119,9 @@ WHITENOISE_AUTOREFRESH = (
)
WHITENOISE_USE_FINDERS = False # Use collected static files only
WHITENOISE_MANIFEST_STRICT = False # More permissive in staging
WHITENOISE_MAX_AGE = 600 # 10 minutes cache for staging (allows easier testing)
WHITENOISE_MAX_AGE = (
600 # 10 minutes cache for staging (allows easier testing)
)
# Staging logging - similar to production but more verbose
LOGGING = {
@@ -148,7 +152,7 @@ LOGGING = {
},
"root": {
"handlers": ["console", "file"],
"level": "INFO",
"level": "DEBUG",
},
"loggers": {
"django": {
@@ -163,7 +167,7 @@ LOGGING = {
},
"django.db.backends": {
"handlers": ["console"],
"level": "INFO", # Show SQL queries in staging for debugging
"level": "DEBUG", # Show SQL queries in staging for debugging
"propagate": False,
},
},
@@ -177,7 +181,10 @@ pathlib.Path(logs_dir).mkdir(parents=True, exist_ok=True)
# Admin email notifications
ADMINS = [
("Staging Admin", os.environ.get("ADMIN_EMAIL", "admin@tiendailusion.local")),
(
"Staging Admin",
os.environ.get("ADMIN_EMAIL", "admin@tiendailusion.local"),
),
]
MANAGERS = ADMINS