Configuration¶
Environment variables control all runtime settings. There is no separate settings_local.py.
event_talks/settings.py
reads each value from the environment through django-environ. If a variable is unset, it uses a
default.
How settings are loaded¶
The project follows the 12-factor convention: operating system environment variables always win. On top of that, the app can optionally read variables from a file.
DJANGO_READ_VARS_FILE(defaultFalse). WhenTrue, settings are also read fromdjango-vars.envin the project root. OS environment variables still take precedence over file values.scripts/dev-setup.shsets this for you. Ifdjango-vars.envis present, it setsTrue, and if not,False. A normal local checkout therefore reads from the committed file.
READ_VARS_FILE = env.bool("DJANGO_READ_VARS_FILE", default=False)
if READ_VARS_FILE:
environ.Env.read_env(BASE_DIR / "django-vars.env")
Keep django-vars.env and docker/.env in sync
There are two environment files. django-vars.env drives local development. docker/.env drives
the Docker Compose production stack. When you add, rename, or remove a variable in one, you must
make the matching change in the other in the same commit. They are intentionally kept aligned so a
setting that exists in dev is not silently missing in production.
Never commit real secrets
django-vars.env and docker/.env are tracked, so they must contain only placeholders or safe
local defaults. The committed DJANGO_SECRET_KEY is an obvious dev-only placeholder and must be
replaced in production. Real tokens (Pretalx, Vimeo, Mailgun, Discord) and the real secret key
belong only in the deployment environment, never in a commit.
If a variable is unset, settings.py uses the value in the "Default" column of the tables below.
The tables also note where the committed django-vars.env uses a different value for local
development.
Core Django¶
| Variable | Default | Purpose |
|---|---|---|
DJANGO_DEBUG |
False |
Debug mode. django-vars.env sets True for local development. |
DJANGO_SECRET_KEY |
unsafe-secret-key |
Cryptographic signing key. Must be replaced in production. |
DJANGO_ALLOWED_HOSTS |
empty | Comma-separated hosts Django will serve. Dev file sets localhost,.... |
SITE_ID |
1 |
django.contrib.sites site id. |
LANGUAGE_CODE |
en |
Default/source language. One of settings.LANGUAGES (en, pt-br, de, es). |
TIME_ZONE |
Europe/Berlin |
Project time zone. |
USE_I18N |
True |
Enable Django translation machinery. |
USE_TZ |
True |
Store datetimes as timezone-aware UTC. |
LANGUAGE_COOKIE_SECURE |
True |
Mark the django_language cookie Secure. Set False for local dev (no HTTPS). |
DJANGO_ADMIN_URL |
admin/ |
Path prefix for the Django admin site. |
ADMIN_NAMES |
Admin |
Comma-separated admin display names, paired positionally with ADMIN_EMAILS. |
ADMIN_EMAILS |
admin@example.com |
Comma-separated admin emails. Used as ADMINS / MANAGERS. |
Keep the two admin lists the same length: they are paired by position. An address with no matching name still becomes an admin, with an empty display name, and startup warns about the mismatch. A name with no address is ignored, since there is nothing to send to.
Static and media files¶
| Variable | Default | Purpose |
|---|---|---|
DJANGO_STATIC_URL |
static/ |
URL prefix for static assets. |
DJANGO_STATIC_ROOT |
<project>/staticfiles |
Where collectstatic writes files. |
DJANGO_STATICFILES_DIRS |
<project>/static |
Extra source directories for static files. |
DJANGO_STATICFILES_STORAGE |
StaticFilesStorage |
Set to ManifestStaticFilesStorage in prod for hashed names. |
DJANGO_DEFAULT_FILE_STORAGE |
FileSystemStorage |
Default file storage backend. |
DJANGO_MEDIA_URL |
/media/ |
URL prefix for uploaded/generated media. |
DJANGO_MEDIA_ROOT |
media |
Directory for media files (resolved under the project root). |
DJANGO_SERVE_STATIC_LOCALLY |
False |
If True, Django serves static and media files. Use it without Nginx. |
Database¶
A single connection URL sets up the database.
| Variable | Default | Purpose |
|---|---|---|
DATABASE_URL |
sqlite:///db.sqlite3 |
Connection string. Use a postgres://... URL in production. |
DJANGO_CONN_MAX_AGE |
60 |
Seconds to keep a persistent connection open. If the pool is on, Django ignores it. |
DJANGO_CONN_HEALTH_CHECKS |
True |
Detect and replace stale persistent connections. |
DJANGO_DB_POOL |
False |
Postgres + psycopg3 native connection pool. Leave off on SQLite and under ASGI. |
Connection pool vs CONN_MAX_AGE
These are mutually exclusive. With DJANGO_DB_POOL=True (Postgres only), Django manages a pool and
DJANGO_CONN_MAX_AGE is ignored. The default keeps a single connection warm per worker for up to
CONN_MAX_AGE seconds, which works on any backend including SQLite.
Cache¶
| Variable | Default | Purpose |
|---|---|---|
DJANGO_CACHE_URL |
locmemcache:// |
Cache backend URL. Use redis://redis:6379/0 in production. |
The default cache is per process
locmemcache:// lives inside one worker. Two things need a backend that all workers share. The
first is the Q&A rate limiter: on a per-process cache, its allowance becomes "limit x number of
workers". The second is the allauth OAuth bearer token: on a per-process cache, each process fetches
its own.
The default cache is enough for local development and a single-worker deployment. For anything larger, point it at Redis. The Docker Compose stack ships a Redis service and uses it already.
The local backend also stores at most 300 entries. When it is full, it evicts entries at random, and
on a busy talk it can lose live rate-limit counters. For this reason, the settings module raises
MAX_ENTRIES for it.
A cache that the app cannot reach fails open: the rate limiter allows the action and logs a warning. Django does not wrap backend errors. Without this behavior, a short Redis outage raises an uncaught driver exception, and every question submission returns a 500 error. Losing the limit for the length of an outage is a smaller problem than losing the Q&A.
Email¶
The app sends login codes and admin notifications by email. In development, email goes to Mailpit. In production, it goes through Mailgun with django-anymail.
| Variable | Default | Purpose |
|---|---|---|
DJANGO_EMAIL_BACKEND |
django.core.mail.backends.smtp.EmailBackend |
Email backend. Set to the Mailgun Anymail backend in prod. |
EMAIL_HOST |
localhost |
SMTP host (Mailpit in dev). |
EMAIL_PORT |
1025 |
SMTP port. The setup script points dev at Mailpit on 1026. |
EMAIL_TIMEOUT |
10 |
SMTP socket timeout in seconds. |
DEFAULT_FROM_EMAIL |
webmaster@localhost |
Default From address. |
SERVER_EMAIL |
root@localhost |
From address for error mail to admins. |
MAILGUN_API_KEY |
empty | Mailgun API key. The Anymail backend requires it. |
MAILGUN_API_URL |
https://api.eu.mailgun.net/v3 |
Mailgun API base URL. |
MAILGUN_SENDER_DOMAIN |
empty | Mailgun sending domain. The Anymail backend requires it. |
Only the Anymail backend reads the Mailgun variables
If DJANGO_EMAIL_BACKEND is anymail.backends.mailgun.EmailBackend, Django reads the MAILGUN_*
variables. With the default SMTP backend, Django ignores them.
Authentication and accounts¶
These tune the passwordless email-code login. See Authentication for the full flow.
| Variable | Default | Purpose |
|---|---|---|
LOGIN_REDIRECT_URL |
home |
Where to send users after a successful login. |
ACCOUNT_LOGIN_BY_CODE_TIMEOUT |
300 |
Seconds a login code stays valid. |
ACCOUNT_EMAIL_SUBJECT_PREFIX |
empty | Prefix added to account email subjects. |
ALLAUTH_TRUSTED_PROXY_COUNT |
0 |
Number of trusted reverse proxies. Set to 1 behind the bundled Nginx. |
Set the proxy count correctly behind a proxy
ALLAUTH_TRUSTED_PROXY_COUNT must match the number of trusted proxy hops in front of the app. If it
stays 0 behind Nginx, every request seems to come from 127.0.0.1. Then allauth puts all of its
per-IP rate limits into one global bucket, and a single attacker can lock everyone out. The Docker
and Nginx deployment sets it to 1.
Email validation API¶
Before the app creates an account for a new attendee, it sends the email address to an external
validation API. The API tells whether that address bought a ticket. An event can define its own
validation_api_url. If it does not, the app uses the fallback below.
| Variable | Default | Purpose |
|---|---|---|
EMAIL_VALIDATION_API_URL_FALLBACK |
empty | Validation API URL for an event that does not define its own. |
EMAIL_VALIDATION_API_TIMEOUT |
10 |
Timeout in seconds for validation API calls. |
AUTHORIZED_EMAILS_WHITELIST |
ADMIN_EMAILS |
Emails that bypass API validation entirely. Case and spacing ignored. |
EMAIL_VALIDATION_API_OAUTH2_CLIENT_ID |
empty | OAuth2 client id for authenticated validation calls. |
EMAIL_VALIDATION_API_OAUTH2_CLIENT_SECRET |
empty | OAuth2 client secret. |
EMAIL_VALIDATION_API_OAUTH2_TOKEN_URL |
empty | OAuth2 token endpoint. All three OAuth2 values are required to enable. |
An unset AUTHORIZED_EMAILS_WHITELIST falls back to ADMIN_EMAILS
If you leave the variable out, every address in ADMIN_EMAILS becomes a login-bypass entry. The app
checks the whitelist before the event check and before the is_active gate. An empty value is
different: AUTHORIZED_EMAILS_WHITELIST= gives an empty whitelist and does not fall back. Decide
which one you want. ADMIN_EMAILS also decides who receives exception mail.
Q&A anti-spam¶
Public events accept any email at registration, so the Q&A has several floors under it. See Event visibility for how they fit together. All limits are keyed per user account, never per IP: the venue's attendees share one NAT address.
| Variable | Default | Purpose |
|---|---|---|
QA_QUESTION_RATE_LIMIT_PER_TALK |
5 |
Questions one account can ask about one talk per window. |
QA_QUESTION_RATE_WINDOW_PER_TALK |
600 |
That window, in seconds. |
QA_QUESTION_RATE_LIMIT_OVERALL |
20 |
Questions one account can ask across all talks per window. |
QA_QUESTION_RATE_WINDOW_OVERALL |
3600 |
That window, in seconds. |
QA_SPAM_KEYWORDS |
empty | Extra words that send a question to the moderation queue. |
LOGIN_CODE_IP_RATE_LIMIT |
60/5m/ip |
Per-IP ceiling on login-code requests, on top of the per-email limit. |
ADD_EMAIL_RATE_LIMIT |
5 |
"Add a ticket email" codes one account can request per window. |
ADD_EMAIL_RATE_WINDOW |
3600 |
That window, in seconds. |
You set the rate limits through environment variables because an organizer needs to loosen them
during the conference, not at deploy time. Keep LOGIN_CODE_IP_RATE_LIMIT well above the
opening-session rush: it exists to make bulk signup pointless, not to throttle real attendees.
ADD_EMAIL_RATE_LIMIT covers the "add a ticket email" flow for Discord-only accounts. This project
owns that view, not allauth, so ACCOUNT_RATE_LIMITS does not apply to it. The flow sends a code to
any address that the user types. The limit bounds that mail, the ticket-API call behind it, and the
"already in use" answer. Without the limit, that answer tells a visitor which addresses have an
account. The view rejects a malformed address before it applies the limit, so a typo costs nothing.
QA_SPAM_KEYWORDS is empty by default. Keyword lists date badly, so it is a lever for a conference
under a specific ongoing campaign rather than something to maintain speculatively.
Cloudflare Turnstile¶
Optional. If either key is unset, the app skips the captcha, so local development and CI need no extra variables.
| Variable | Default | Purpose |
|---|---|---|
TURNSTILE_SITE_KEY |
empty | Public widget key. Blank disables the captcha. |
TURNSTILE_SECRET_KEY |
empty | Server-side key. Blank disables the captcha. |
TURNSTILE_TIMEOUT |
5 |
Seconds to wait for Cloudflare. |
TURNSTILE_FAIL_OPEN |
True |
If Cloudflare is unreachable, let submissions through. |
TURNSTILE_FAIL_OPEN is on by default. A conference Q&A that goes down during another company's
outage is worse than a few minutes without a captcha. If you prefer to refuse submissions over
accepting unverified ones, set it to False.
Discord OAuth¶
Optional login with Discord, gated by guild membership and role. See Authentication for how roles map to permissions.
| Variable | Default | Purpose |
|---|---|---|
DISCORD_CLIENT_ID |
empty | Discord OAuth application client id. |
DISCORD_CLIENT_SECRET |
empty | Discord OAuth application client secret. |
DISCORD_GUILD_ID |
empty | Numeric id of the Discord server checked for membership. |
DISCORD_API_TIMEOUT |
5 |
Timeout in seconds for Discord API calls. |
DISCORD_ROLES |
{} |
JSON map of role name to role id, for example {"attendee":"BBBBB"}. |
DISCORD_ALLOWED_ROLES |
empty | Role names permitted to log in. Empty means no Discord access. |
DISCORD_ADMIN_ROLES |
empty | Role names that grant is_superuser and is_staff. |
DISCORD_STAFF_ROLES |
empty | Role names that grant is_staff only. |
An empty DISCORD_ALLOWED_ROLES rejects all Discord logins
Discord access is opt-in. If no allowed roles are set, the app rejects every Discord login. Roles in
DISCORD_ROLES must use the same names referenced by the allowed/admin/staff lists.
Pretalx sync¶
Talk import from the Pretalx REST API. See Pretalx sync for the importer modes and workflow.
| Variable | Default | Purpose |
|---|---|---|
PRETALX_API_TOKEN |
empty | API token used by import_pretalx_talks. |
PICKLE_PRETALX_TALKS |
False |
Cache fetched Pretalx data to disk to speed up repeated imports. |
PRETALX_DIGEST_RECIPIENTS |
falls back to ADMINS |
Recipients of the detect-only summary email. Set to - to disable the digest. |
Livestreams and video¶
| Variable | Default | Purpose |
|---|---|---|
LIVESTREAMS_SHEET_ID |
empty | Google Sheet id used by import_livestream_urls. |
LIVESTREAMS_WORKSHEET_NAME |
Livestreams |
Worksheet name within that sheet. |
VIMEO_ACCESS_TOKEN |
empty | Vimeo API token used by update_video_links. |
VIMEO_PROJECT_IDS |
empty | Comma-separated Vimeo project ids to scan for recordings. |
Social cards¶
The app renders talk social cards with a font that you can change.
| Variable | Default | Purpose |
|---|---|---|
TALK_CARD_FONT |
assets/fonts/NotoSans.ttf |
Path to the TrueType font used for card text. |
TALK_CARD_FONT_NAME |
Noto Sans |
Font family name reported in card metadata. |
Logging¶
| Variable | Default | Purpose |
|---|---|---|
LOG_LEVEL |
INFO |
Level for the event_talks, users, and talks loggers. |
AUTH_LOG_LEVEL |
INFO |
Level for the dedicated auth logger (writes to auth.log). |
DJANGO_DATABASE_LOG_LEVEL |
ERROR |
Level for django.db.backends. |
DJANGO_LOGS_DIR |
<project>/logs |
Directory for rotating JSON log files. |
LOG_EMAIL_HASH |
True |
Hash email addresses in logs instead of writing them in the clear. |
Email privacy in logs
With LOG_EMAIL_HASH=True, the logs record each email address as a SHA-256 hash, not as plain text.
Log files therefore do not leak attendee addresses. Authentication tells more
about this.
Error tracking (Sentry)¶
If no DSN is set, the app does not start Sentry, so development and test runs send nothing.
| Variable | Default | Purpose |
|---|---|---|
SENTRY_DSN |
empty | Sentry project DSN. Leave blank to disable Sentry. |
SENTRY_ENVIRONMENT |
production, development in debug mode |
Environment tag reported to Sentry. |
SENTRY_TRACES_SAMPLE_RATE |
0.0 |
Performance trace sampling rate (errors are always captured). |
SENTRY_SEND_DEFAULT_PII |
False |
Whether to send user identifiers. Off by default for privacy. |
Security and cookies¶
These default to safe production values, so the local django-vars.env relaxes them for HTTP
development.
| Variable | Default | Purpose |
|---|---|---|
SESSION_COOKIE_SECURE |
True |
Send the session cookie over HTTPS only. Dev file sets False. |
CSRF_COOKIE_SECURE |
True |
Send the CSRF cookie over HTTPS only. Dev file sets False. |
DJANGO_CSRF_TRUSTED_ORIGINS |
http://localhost,http://127.0.0.1 |
Origins trusted for CSRF. |
SECURE_HSTS_SECONDS |
31536000 |
HSTS max-age (1 year). Dev file sets 0 to disable HSTS. |
SECURE_HSTS_INCLUDE_SUBDOMAINS |
True |
Apply HSTS to subdomains. |
SECURE_HSTS_PRELOAD |
False |
Opt in to the HSTS preload list. Off by default. |
DATA_UPLOAD_MAX_NUMBER_FIELDS |
3000 |
Max form fields per request (raised to manage many users at once). |
The code sets the other security headers, and no environment variable changes them. These are
X-Frame-Options: DENY, content-type nosniff, the referrer policy, the cross-origin opener policy,
and SECURE_PROXY_SSL_HEADER.
Feature flags and event behaviour¶
| Variable | Default | Purpose |
|---|---|---|
DEFAULT_EVENT |
empty | Slug of the event pre-selected on the login page and linked on signup. |
SHOW_UPCOMING_TALKS_LINKS |
False |
Show links to upcoming talks. Dev file sets True. |
IMPORT_TALKS_WITHOUT_SPEAKERS |
True |
Allow Pretalx import of talks that have no speakers yet. |
CHAIR_ROOM_TRANSITION_MINUTES |
5 |
Default minutes a volunteer needs to change rooms. An event can set its own value in its staffing settings. |
STAFFING_TAKE_WINDOW_MINUTES |
30 |
Default minutes before a duty starts from which a volunteer may take an open spot in it themselves. An event can set its own value in its staffing settings. |
STAFFING_SOLVER_WORKERS |
8 |
Parallel workers of the staffing allocation solver. Results are repeatable for a given number, so a change can pick a different plan among equally good ones. |
Multi-event behaviour¶
This instance can host several conferences at once. Each Event has its own slug, branding, talks,
and validation API URL, and users are linked to the events they have access to.
DEFAULT_EVENTis the slug shown pre-selected on the login page. The current default ispyconde-pydata-2026. New users authorizing via Discord are linked to this event, and the login view offers it as the default selection.- A regular user only sees the active events they are linked to. Superusers see all active events.
- The committed dev defaults set
DEFAULT_EVENT=pyconde-pydata-2026, anddev-setup.shcreates thepyconde-pydata-2025,pyconde-pydata-2026, andpydata-berlin-2026sample events.pyconde-pydata-2025is created public (browsable without logging in) and the two 2026 events stay hidden, which gives a dev instance one event of each kind.
For how events relate to talks, users, and the rest of the data model, see Architecture.