Skip to content

Configuration

Oak-Ed is configured through environment variables, read from a .env file in the project root (or from the process environment in production).

Required Variables

Variable Description
SECRET_KEY Django secret key. Use a long random string. Never share or commit this.
DATABASE_URL Database connection string. See examples below.
GEMINI_API_KEY Your Google Gemini API key. Required for AI lesson generation.

Optional Variables

Variable Default Description
DEBUG False Set to True in development only. Never use True in production.
ALLOWED_HOSTS * Comma-separated list of allowed hostnames (e.g. example.com,www.example.com).
CSRF_TRUSTED_ORIGINS (empty) Comma-separated list of trusted origins for CSRF (e.g. https://example.com). Required in production behind a proxy.
GEMINI_MODEL gemini-2.5-flash Override the Gemini model used for AI generation.
GOOGLE_CLIENT_ID (empty) Google OAuth client ID. Required only if using Google sign-in.
GOOGLE_CLIENT_SECRET (empty) Google OAuth client secret. Required only if using Google sign-in.
ACCOUNT_DEFAULT_HTTP_PROTOCOL https Protocol used by allauth for callback URLs. Set to http for local development without HTTPS.

Database URL Format

PostgreSQL (recommended for production):

DATABASE_URL=postgres://user:password@host:5432/dbname

SQLite (for local development without Docker):

DATABASE_URL=sqlite:///db.sqlite3

The Docker Compose setup uses PostgreSQL by default:

DATABASE_URL=postgres://postgres:postgres@db:5432/oaked

Example .env for Development

DEBUG=True
SECRET_KEY=replace-with-a-long-random-string
DATABASE_URL=postgres://postgres:postgres@db:5432/oaked
ALLOWED_HOSTS=localhost,127.0.0.1,0.0.0.0
GEMINI_API_KEY=your_google_gemini_api_key_here
ACCOUNT_DEFAULT_HTTP_PROTOCOL=http

Example .env for Production

DEBUG=False
SECRET_KEY=a-very-long-random-secret-key
DATABASE_URL=postgres://user:password@db-host:5432/oaked
ALLOWED_HOSTS=yourdomain.com
CSRF_TRUSTED_ORIGINS=https://yourdomain.com
GEMINI_API_KEY=your_google_gemini_api_key_here