Environment Variables

M
Written By Melih SünbülLast updated 5 months ago

Lex App reads its runtime configuration from environment variables — usually loaded from the .env file lex setup generates at your project root. This page lists the variables the framework actively reads.

This index covers the variables the framework reads directly. Your project's Django settings may layer additional ones on top. If a variable isn't listed here, check lex_app/settings.py in the installed package.

Async / Celery

Variable

Purpose

CELERY_ACTIVE

true to dispatch @lex_shared_task-decorated functions to Celery workers; otherwise tasks run synchronously in the current process. See Celery & Async Calculations.

IS_RUNNING_IN_CELERY

Set to true inside Celery worker processes so the framework knows it's executing a queued task rather than a web request. Set automatically when you launch via lex celery / lex celery-workers.

Streamlit

Variable

Purpose

IS_STREAMLIT_ENABLED

true to enable the Streamlit toolbar icon in the frontend. See Streamlit Dashboards.

Keycloak / OIDC

Variable

Purpose

KEYCLOAK_REALM

Name of the Keycloak realm the framework targets when syncing models, fields, and groups.

KEYCLOAK_REALM_NAME

Display name of the realm (used during bootstrap). Falls back to KEYCLOAK_REALM if unset.

OIDC_RP_CLIENT_ID

Your project's OIDC client ID — the identifier the browser logs in against.

Additional KEYCLOAK_* / OIDC_* variables (server URL, client secret, admin credentials) are read at the Django-settings layer. lex setup writes a complete set into your .env — start from that file rather than constructing the list by hand.

Mail

Variable

Purpose

SENDGRID_API_KEY

API key used to send the PDF test report (lex pytest --report-and-email) and any project-level transactional mail.

Where these get set

Place

When it's used

.env at project root

Local development. Loaded by PyCharm run configs and set -a; source .env; set +a in the terminal.

Container / cloud env

Production. Whatever your platform's secret manager exposes (Docker --env-file, Kubernetes Secrets, etc.).

If you change anything in .env, restart your lex start / lex streamlit processes (and your Celery workers if you have them) — the variables are read once at startup.

See also

  • CLI Commands — every command that reads these variables.
  • lex_config.py — the Python-side configuration that complements these env vars.
  • Installation — how .env is generated by lex setup.

Was this helpful?

Your feedback shapes what we write next.