Skip to main content

Prerequisites

Before starting, copy the sample environment file to the project root:
cp contrib/.env.sample .env
Edit .env with your settings. The most important variables are covered in the configuration reference below.

Environment variables

The .env file controls all runtime configuration. Key variables:
VariableTypeDescription
SECRET_KEYstringDjango secret key. Required.
ENVIRONMENTstringdevelopment or production. Controls DEBUG mode.
LOG_LEVELstringGunicorn log level (e.g. debug, info). Setting debug enables the Django Debug Toolbar.
ALLOWED_HOSTSstringComma-separated list of allowed hostnames. Defaults to *.
WEB_WORKERSintNumber of Gunicorn worker processes.
WEB_TIMEOUTintGunicorn worker timeout in seconds.
CACHE_BACKENDstringDjango cache backend class (e.g. django.core.cache.backends.memcached.MemcachedCache).
CACHE_LOCATIONstringCache server address (e.g. localhost:11211).
VariableTypeDescription
DATABASE_URLstringPostgreSQL connection URL. Must be PostgreSQL — JSONField and SearchVectorField require it.
CELERY_BROKER_URLstringRabbitMQ or other Celery-compatible broker URL (e.g. amqp://guest:guest@localhost//).
VariableTypeDescription
GOOGLE_ANALYTICSstringGoogle Analytics tracking ID (e.g. UA-123456-7).
GOOGLE_STREET_VIEW_API_KEYstringGoogle Street View Image API key for receipt location previews.
VariableTypeDescription
TWITTER_CONSUMER_KEYstringTwitter API key.
TWITTER_CONSUMER_SECRETstringTwitter API secret.
TWITTER_ACCESS_TOKENstringTwitter access token.
TWITTER_ACCESS_SECRETstringTwitter access token secret.
Obtain credentials by following the python-twitter getting started guide.
VariableTypeDescription
VIRTUAL_HOST_WEBstringHostname for the HTTPS certificate. Add to /etc/hosts when testing locally.
LETSENCRYPT_EMAILstringEmail address for the Let’s Encrypt certificate.
HTTPS_METHODstringSet to noredirect to disable HTTP→HTTPS redirect. Default is redirect.
USE_X_FORWARDED_HOSTboolWhether to trust the X-Forwarded-Host header.
SECURE_PROXY_SSL_HEADERstringTuple-like value for SECURE_PROXY_SSL_HEADER (e.g. HTTP_X_FORWARDED_PROTO,https).

Build docs developers (and LLMs) love