Configuration (.env)¶
The application is configured with environment variables from the .env file in the project root. Templates are in the repository:
.env.docker.examplefor Docker,.env.examplefor a local installation.
After changing .env, restart the application (docker compose up -d, or restart the server).
Django and security¶
| Variable | Default | Description |
|---|---|---|
SECRET_KEY |
(insecure default) | Required. A long random string, never share it. |
DEBUG |
False |
Always False in production. |
ALLOWED_HOSTS |
127.0.0.1,localhost |
Comma-separated domains and IP addresses the app responds on. Locally, add the computer's IP so you can scan from a phone. |
CSRF_TRUSTED_ORIGINS |
(empty) | Full origins including the scheme, e.g. https://odbavto.example.com. Required behind an HTTPS proxy. |
BEHIND_PROXY |
False |
True behind a reverse proxy that terminates TLS. Hard-coded in docker-compose.yml. |
SECURE_SSL_REDIRECT |
False |
HTTP → HTTPS redirect in Django. Not needed behind Caddy, which redirects itself. |
SESSION_COOKIE_SECURE |
False |
True = session cookie over HTTPS only. Turn on in production. |
CSRF_COOKIE_SECURE |
False |
True = CSRF cookie over HTTPS only. Turn on in production. |
RATELIMIT_ENABLE |
True |
Request rate limiting (scan 60/min, import 10/h per IP). |
HTTPS is an operational requirement
The hostess access link and the login session must go over HTTPS. On a server, set SESSION_COOKIE_SECURE=True and CSRF_COOKIE_SECURE=True. These options only apply with DEBUG=False.
Database¶
| Variable | Default | Description |
|---|---|---|
DATABASE_URL |
(empty = SQLite) | E.g. postgres://user:password@db:5432/odbavto. In Docker it is built automatically from DB_*. |
DB_NAME, DB_USER, DB_PASSWORD |
Docker only: credentials for the PostgreSQL container. | |
CREATE_DEFAULT_USER |
True without DATABASE_URL, otherwise False |
Creates the user odbavto / odbavto on an empty database. |
Docker¶
| Variable | Description |
|---|---|
COMPOSE_PROJECT_NAME |
Project name. Determines the container name (<name>-web) and the volume prefix. Lets you run several instances on one server (e.g. odbavto and odbavto-staging). |
Language and logging¶
| Variable | Default | Description |
|---|---|---|
LANGUAGE_CODE |
cs |
Default interface language: cs or en. Users can switch it. |
LOG_LEVEL |
INFO |
DEBUG, INFO, WARNING, ERROR. |
The time zone is fixed to Europe/Prague.
Printing and WebSockets¶
| Variable | Default | Description |
|---|---|---|
ENABLE_DIRECT_PRINTING |
False |
Enables the Direct print backend (printing from the server through the Windows driver). Local Windows installation only. |
REDIS_HOST |
127.0.0.1 |
Redis for WebSockets. In Docker redis. |
REDIS_PORT |
6379 |
|
REDIS_SOCKET_TIMEOUT |
30 |
Must be more than 5 s, otherwise WebSockets drop every ~5 s. |
PENDING_JOB_MAX_AGE_SECONDS |
300 |
Older unclaimed print jobs are discarded so that old badges don't print when the agent comes back online. |