Environment Configuration
The .env file is automatically generated by script 01 and placed at /var/www/proenergia/app/.env. Key variables:
| Variable | Description |
|---|---|
DJANGO_SECRET_KEY | Auto-generated Django secret key. Never share or commit. |
DJANGO_DEBUG | Set to False in production. |
DATABASE_URL | PostGIS connection string. Format: postgis://user:password@localhost:5432/proenergia_db |
ALLOWED_HOSTS | Comma-separated allowed hostnames (your domain and www subdomain). |
CSRF_TRUSTED_ORIGINS | Comma-separated trusted origins for CSRF protection. |
STATIC_ROOT | Filesystem path where collectstatic writes static files. |
MEDIA_ROOT | Filesystem path where uploaded files and PMTiles are stored. |
CELERY_BROKER_URL | RabbitMQ connection: amqp://proenergia:<password>@localhost:5672/proenergia_vhost |
CELERY_WORKERS | Number of Celery worker processes (default: 2). |
CELERY_WORKER_CONCURRENCY | Concurrency per worker (default: 4). |
CACHE_BACKEND | Database cache backend: django.core.cache.backends.db.DatabaseCache |
CACHE_LOCATION | Cache table name: summaries_cache_table |
Security
The .env file has permissions 600 (owner read/write only). Never commit it to version control.
Database name
The production database is named proenergia_db (not proenergia). The RabbitMQ vhost is proenergia_vhost. These differ from a typical local development setup.