Skip to main content

Environment Configuration

The .env file is automatically generated by script 01 and placed at /var/www/proenergia/app/.env. Key variables:

VariableDescription
DJANGO_SECRET_KEYAuto-generated Django secret key. Never share or commit.
DJANGO_DEBUGSet to False in production.
DATABASE_URLPostGIS connection string. Format: postgis://user:password@localhost:5432/proenergia_db
ALLOWED_HOSTSComma-separated allowed hostnames (your domain and www subdomain).
CSRF_TRUSTED_ORIGINSComma-separated trusted origins for CSRF protection.
STATIC_ROOTFilesystem path where collectstatic writes static files.
MEDIA_ROOTFilesystem path where uploaded files and PMTiles are stored.
CELERY_BROKER_URLRabbitMQ connection: amqp://proenergia:<password>@localhost:5672/proenergia_vhost
CELERY_WORKERSNumber of Celery worker processes (default: 2).
CELERY_WORKER_CONCURRENCYConcurrency per worker (default: 4).
CACHE_BACKENDDatabase cache backend: django.core.cache.backends.db.DatabaseCache
CACHE_LOCATIONCache 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.