feat: Add staging environment for local production testing

- Add docker-compose.staging.yml with PostgreSQL and Django
- Add .env.staging.example with staging-specific environment variables
- Configure staging settings (DEBUG=False, no SSL redirect for localhost)
- Update settings/__init__.py to support staging environment detection
- Update AGENTS.md with staging environment documentation
- Update .gitignore to exclude .env.staging
- Optimize docker-compose.prod.yml configuration

Staging environment simulates production configuration locally:
- PostgreSQL database (port 5433 to avoid conflicts)
- Gunicorn with 4 workers
- DEBUG=False but HTTP allowed for easier testing
- Separate volumes for static files, media, and logs

Usage:
  cp .env.staging.example .env.staging
  docker compose -f docker-compose.staging.yml up -d
This commit is contained in:
2026-05-10 20:32:42 -05:00
parent 8818246870
commit bf69fe88d9
7 changed files with 198 additions and 18 deletions

51
.env.staging.example Normal file
View File

@@ -0,0 +1,51 @@
# Staging Environment Variables
# Testing de producción en localhost sin SSL
# Este ambiente simula producción pero permite HTTP en localhost
# Django Environment
DJANGO_ENV=staging
# Debug mode (False para simular producción)
DEBUG=False
# Django Secret Key
# Para staging local, puedes usar una key fija (NO usar en producción real)
SECRET_KEY=staging-local-key-zh6rinl@8y7g(cf781snisx2j%p^c#d&b2@@9cqe!v@4yv8x=v
# Allowed hosts (localhost para testing)
ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0
# CORS allowed origins (permite acceso desde navegador local)
# Incluye común puertos de desarrollo de frontend y acceso directo
CORS_ALLOWED_ORIGINS=http://localhost:8000,http://localhost:3000,http://localhost:5173,http://localhost:7001,http://127.0.0.1:8000
# CSRF Trusted Origins (localhost HTTP para staging)
CSRF_TRUSTED_ORIGINS=http://localhost:8000,http://127.0.0.1:8000
# PostgreSQL Database Configuration (staging local)
DB_NAME=tienda_ilusion_staging
DB_USER=tienda_ilusion_user
DB_PASSWORD=staging_local_password
DB_HOST=postgres
DB_PORT=5432
# Email Configuration (console backend para staging)
EMAIL_HOST=smtp.gmail.com
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_HOST_USER=staging@tiendailusion.local
EMAIL_HOST_PASSWORD=staging_password
DEFAULT_FROM_EMAIL=staging@tiendailusion.local
# Admin notifications
ADMIN_EMAIL=admin@tiendailusion.local
# Tryton ERP Configuration (Staging)
# Ajusta estos valores según tu entorno de staging de Tryton
TRYTON_HOST=localhost
TRYTON_DATABASE=tryton_staging
TRYTON_USERNAME=admin
TRYTON_PASSWORD=admin
# Staging specific: Disable SSL redirect for localhost testing
STAGING_DISABLE_SSL=True