Skip to content

Settings

karni_settings(globals()) in config/settings.py fills the module with every Django, DRF, Celery, storage and Karni setting, most of them read from the environment (.env for host runs, the compose file or CI for the rest). Anything assigned after the call wins, and any name defined before it is never overwritten. The call also leaves env, the django-environ reader Karni reads its own defaults with, in the module, so a setting added after it reads the environment the same way: FEATURE_X = env.bool("FEATURE_X", default=False). SILENCED_SYSTEM_CHECKS starts as an empty list, so SILENCED_SYSTEM_CHECKS += ["karni.W967"] silences a check without a NameError. Settings read during the call are the exception (see below). So is a setting a module chooses from the environment first (KARNI_PAYMENTS_PROVIDER): its environment variable, when set, wins over a value written before the call, such as karni.yaml's, so .env switches a local try to the test provider. This page lists the KARNI_* settings. The Django and DRF settings Karni derives are documented where the feature is.

Settings read during the call

A few settings are read while karni_settings() runs, to compute other settings:

  • KARNI_AUTH_MODE: CSRF_TRUSTED_ORIGINS and CORS_ALLOW_CREDENTIALS (session mode), and django-otp's middleware with KARNI_2FA
  • KARNI_2FA: INSTALLED_APPS and MIDDLEWARE (django-otp)
  • KARNI_SOCIAL_AUTH: INSTALLED_APPS, MIDDLEWARE, AUTHENTICATION_BACKENDS and TEMPLATES (django-allauth)
  • KARNI_SOCIAL_PROVIDERS: INSTALLED_APPS (one django-allauth provider app each)
  • KARNI_FRONTEND_URL: CSRF_TRUSTED_ORIGINS (session mode)
  • KARNI_AUTH_THROTTLE_RATES: REST_FRAMEWORK['DEFAULT_THROTTLE_RATES']
  • KARNI_JSON_LOGS: LOGGING and the structlog renderer
  • KARNI_CACHE: CACHES
  • KARNI_STORAGE: STORAGES
  • KARNI_PEOPLE: INSTALLED_APPS (karni.people, the people contract)
  • KARNI_STATIC_STORAGE: STORAGES['staticfiles']
  • KARNI_SINGLE_PROCESS: KARNI_CACHE, CELERY_TASK_ALWAYS_EAGER, CELERY_BROKER_URL, KARNI_READYZ_CHECKS and KARNI_HEALTH_CHECKS

Set them in .env, define them above the call, or pass them to it: karni_settings(globals(), KARNI_AUTH_MODE="session"). Assigned below the call, they cannot change what the call already computed from them, so startup fails with karni.E508, which names the setting. Every other setting works below the call. KARNI_ADMIN_LOGO is one of them: the admin reads it on every request.

All settings

Setting Env Default What it does
Accounts & auth
KARNI_AUTH_MODE KARNI_AUTH_MODE "jwt" jwt (SimpleJWT token pairs) or session (cookie auth + CSRF bootstrap). See accounts.
KARNI_2FA KARNI_2FA False Enable TOTP two-factor auth with django-otp (needs karni[2fa]).
KARNI_SOCIAL_AUTH KARNI_SOCIAL_AUTH False Enable social login through django-allauth (karni[social], session mode only).
KARNI_SOCIAL_PROVIDERS KARNI_SOCIAL_PROVIDERS [] Comma-separated allauth providers to enable, e.g. google,github.
KARNI_SOCIAL_TOKEN_PROVIDERS KARNI_SOCIAL_TOKEN_PROVIDERS {} Experimental. The providers whose ID tokens sign users in, in both auth modes and without KARNI_SOCIAL_AUTH: {"google": {"client_ids": [...]}, "microsoft": {"client_ids": [...], "tenants": [...], "trusted_tenants": [...]}, "apple": {"client_ids": [...]}}, each with optional require_nonce and class (a dotted IdTokenProvider path). Each one mounts social/<provider>/. Needs karni[social-token]. See sign-in with an ID token.
KARNI_SOCIAL_TOKEN_SIGNUP KARNI_SOCIAL_TOKEN_SIGNUP None Experimental. What a token without an account does: open creates the account, approval creates it inactive until an administrator activates it, existing refuses (E223). None is open while KARNI_ACCOUNTS_REGISTRATION is on, else existing.
KARNI_SOCIAL_TOKEN_LINK_VERIFIED KARNI_SOCIAL_TOKEN_LINK_VERIFIED True Experimental. Link a token to the existing account with its email when the provider verified the address. False refuses an account that has a password (E227).
KARNI_SOCIAL_TOKEN_LEEWAY KARNI_SOCIAL_TOKEN_LEEWAY 60 Experimental. Seconds of clock skew allowed on a token's exp, iat and nbf (0 to 300).
KARNI_SOCIAL_TOKEN_JWKS_TTL KARNI_SOCIAL_TOKEN_JWKS_TTL 21600 Experimental. Seconds a provider's signing keys (JWKS) stay in the default cache. An unknown key id fetches them again, at most once a minute per provider.
KARNI_SOCIAL_TOKEN_JWKS_FETCHER "karni.accounts.social_token.fetch_jwks" Experimental. Dotted path of the function (url) -> dict that fetches a key set (HTTPS, 5 second timeout by default).
KARNI_EMAIL_OTP KARNI_EMAIL_OTP False Experimental. Sign-in with a code sent by email, in both auth modes: mounts otp/send/ and otp/verify/. Off, both answer 404 and are absent from the OpenAPI schema. See sign in with a code.
KARNI_EMAIL_OTP_TTL KARNI_EMAIL_OTP_TTL 600 Experimental. Seconds a sign-in code lives (60 to 3600).
KARNI_EMAIL_OTP_LENGTH KARNI_EMAIL_OTP_LENGTH 6 Experimental. Digits in a sign-in code (4 to 10).
KARNI_EMAIL_OTP_MAX_ATTEMPTS KARNI_EMAIL_OTP_MAX_ATTEMPTS 5 Experimental. Guesses a sign-in code takes before it dies (1 to 10). A wrong guess that reaches the cap kills the code.
KARNI_EMAIL_OTP_SIGNUP KARNI_EMAIL_OTP_SIGNUP None Experimental. What a code for an address without an account does: open creates the account when the code is verified, approval creates it inactive until an administrator activates it (E224), existing sends no code. None is open while KARNI_ACCOUNTS_REGISTRATION is on, else existing.
KARNI_TERMS KARNI_TERMS None Experimental. A versioned terms acceptance gate, as a dict (JSON in the environment): {"version": "2026-11", "url": "/terms/", "required": True}, with optional paths (the URL prefixes it covers, default ["/api/"]) and exempt (more prefixes it leaves open). Set, it mounts terms/ and terms/accept/ and adds terms to me/. While it requires acceptance, a signed-in user gets 403 E245 under paths until they accept the current version, staff included. None gates nothing. See terms acceptance.
KARNI_FRONTEND_URL KARNI_FRONTEND_URL "http://localhost:5173" The SPA's origin. It is used in account emails and, in session mode, added to CSRF_TRUSTED_ORIGINS, so the browser's origin must match it.
KARNI_ACCOUNTS_EMAIL_BACKEND "karni.accounts.emails.DjangoEmailBackend" Dotted path of the AccountsEmailBackend that sends every account email: verification, password reset, email change and the sign-in code.
KARNI_ACCOUNTS_AUTO_LOGIN False Sign a user in right after registration (skips email verification as a gate).
KARNI_ACCOUNTS_REGISTRATION KARNI_ACCOUNTS_REGISTRATION True Whether anyone may open an account through register/. False leaves the route out (404) and out of the OpenAPI schema, for a project whose staff create every account. While it is True, karni.W102 warns for a viewset that lets every signed-in user change and delete every row. See closing registration.
KARNI_ACCOUNTS_DEFAULT_ROLES KARNI_ACCOUNTS_DEFAULT_ROLES [] Roles (Django groups) every self-registered user starts with, e.g. attendee.
KARNI_ACCOUNTS_HONEYPOT_FIELD KARNI_ACCOUNTS_HONEYPOT_FIELD "website" Name of the hidden registration field no person fills in. A request that fills it is accepted (202) without creating a user. "" turns the honeypot off. See security.
KARNI_ROLES { "staff": {"name": "Staff", "system": True, "grants": {"*": "all"}}, "user": {"name": "User", "grants": {"*": "own"}}, "customer": {"name": "Customer", "grants": {"*": "own"}}} The project's roles and grants: {slug: {name, description, system, grants: {"app.model:action": scope}}}. Grant patterns take * wildcards, and the scopes are all / own / related:<key> / custom:<name> / tree:<path>. See roles.
KARNI_ROLES_AUTOSYNC KARNI_ROLES_AUTOSYNC True Reconcile the role tables with KARNI_ROLES after every migrate (karni sync-roles does the same by hand).
KARNI_USER_GRANTS KARNI_USER_GRANTS False Experimental. Per-user grants: while True, each user's UserGrant rows (a pattern and a scope as in KARNI_ROLES, with targets and an expiry) join the grants of their roles, for one more query per request. False (the default) reads no row. See per-user grants.
KARNI_NAVIGATION None Experimental. The menu GET /api/navigation/ gives each user: a list of items ({"label", "route", "icon", "order", "requires"}) and groups ({"label", "children": [...]}), or "db" for the NavItem table edited in the admin (add karni.navigation to INSTALLED_APPS), or named menus as a mapping of a name to such a list ({"app": [...], "public": [...], "account": [...]}, read with ?menu=; a list is the app menu). requires is public, authenticated (the default) or a permission pattern as in KARNI_ROLES, so role grants and per-user grants open an item. None (the default) mounts no route. See navigation.
KARNI_NAVIGATION_PAGES ["frontend/src/routes.tsx"] Experimental. The frontend files whose path: entries are the app's pages. karni check reports a menu item whose route none of them serves (E533). [] turns that comparison off.
KARNI_PEOPLE KARNI_PEOPLE False Experimental. True installs the people contract, karni.people: one Person per human and one Organisation per company for every part of the project. Read during the call. karni build writes it when karni.yaml points at people.Person. See people.
KARNI_PEOPLE_RESOLVER "karni.people.services.Resolver" Experimental. Dotted path of the Resolver class (or a subclass) people.resolve() finds or creates people with.
KARNI_PEOPLE_LINK_ON_VERIFY True Experimental. Link an account to the person with its email as soon as the email is verified (sign-up with verification, a sign-in code, a social sign-in with a verified address). False leaves linking to people.link_account().
KARNI_PEOPLE_API True Experimental. Route /api/people/, /api/organisations/, /api/people-memberships/ and /api/people-addresses/. False leaves them out, for a project that routes its own viewsets over the people tables.
KARNI_PEOPLE_MERGE_SKIP [] Experimental. Models a person or organisation merge leaves alone, as "app_label.Model": their rows keep pointing at the merged record.
KARNI_PEOPLE_AUTODISCOVER True Experimental. Import every installed app's people.py at startup, where a part registers its person facts, merge hooks and erase hooks. False: register them in the part's AppConfig.ready().
KARNI_TIMELINE_API True Experimental. Route GET /api/timeline/, a person's, an organisation's or a record's timeline, when karni.timeline is installed. False leaves it out, for a project that mounts its own TimelineView. See timeline.
KARNI_TIMELINE_FROM_EVENTS True Experimental. Write a timeline entry for each family event whose declaration names a timeline title (declare(..., timeline=...)). False writes entries with timeline.record() only.
KARNI_TIMELINE_PAGE_SIZE 25 Experimental. Timeline entries per page of GET /api/timeline/ when ?limit= is not given.
KARNI_TIMELINE_MAX_PAGE_SIZE 100 Experimental. The largest ?limit= of GET /api/timeline/.
KARNI_TIMELINE_RETENTION_DAYS None Experimental. Days a timeline entry is kept. None (the default) keeps them all and schedules no pruning.
KARNI_TIMELINE_VISIBILITY "karni.timeline.access.Visibility" Experimental. Dotted path of the class (a subclass of karni.timeline.access.Visibility) that says which records a request may read, so which timeline entries it sees.
KARNI_PREFERENCES_LOCKED {} Experimental. Values the deployment fixes, by group then name: {"details": {"currency": "EUR"}, "bookings": {"refund_notice_hours": 48}, "connections": {"crm.deal_timeline": False}, "emails": {...}}. Every read answers the lock, the Settings page shows it read only and a change is refused (E324). karni check refuses a name nobody declared or a value its field refuses (E320). See preferences.
KARNI_PREFERENCES_DEFAULTS {} Experimental. Values the deployment starts with, in the shape of KARNI_PREFERENCES_LOCKED. The business can change them in Settings. karni build writes the project's name here, and its currency (app.currency) in KARNI_PREFERENCES_LOCKED.
KARNI_PREFERENCES_API True Experimental. Route /api/preferences/, the API behind the Settings page, when karni.preferences is installed. False leaves it out.
KARNI_PREFERENCES_AUTODISCOVER True Experimental. Import every installed app's preferences.py and connections.py at startup, where parts declare their settings sections, connections and email kinds.
KARNI_NOTIFY_API True Experimental. Route /api/inbox/, /api/email-templates/ and /api/notify/unsubscribe/ when karni.notify is installed. False leaves them out, for a project that mounts its own views. See notifications.
KARNI_NOTIFY_CHANNELS ["email", "inbox"] Experimental. The channels the project sends messages on: "email" and "inbox". A kind declared on a channel left out here is not sent there.
KARNI_NOTIFY_PAGE_SIZE 25 Experimental. Notifications per page of GET /api/inbox/ when ?limit= is not given.
KARNI_NOTIFY_MAX_PAGE_SIZE 100 Experimental. The largest ?limit= of GET /api/inbox/.
KARNI_NOTIFY_RETENTION_DAYS 180 Experimental. Days a notification is kept in the inbox, read or not. A daily task deletes older ones. None keeps them all and schedules nothing.
KARNI_NOTIFY_UNSUBSCRIBE_PATH "/api/notify/unsubscribe/?token={token}" Experimental. Where the unsubscribe link of a marketing email points, after KARNI_FRONTEND_URL: {token} is the signed token. The default is the API's own page, which asks before it unsubscribes.
KARNI_NOTIFY_MOVE_CHANNELS ["email", "inbox"] Experimental. Where the email of a move (moves.<state>.notify in karni.yaml) goes while karni.notify is installed: ["email", "inbox"] (the default), or one of them.
KARNI_ACCOUNTS_TOKEN_TTL { "verify_email": 86400, "reset_password": 3600, "change_email": 86400} Lifetime per one-time token purpose (verify_email, reset_password, ...), as timedeltas.
KARNI_ACCOUNTS_LINKS { "verify_email": "{frontend}/auth/verify-email?token={token}", "reset_password": "{frontend}/auth/reset-password?token={token}", "change_email": "{frontend}/auth/confirm-email-change?token={token}"} Frontend URL template per token purpose, with {frontend} and {token} placeholders.
KARNI_AUTH_THROTTLE_RATES computed (_auth_throttle_rates(env)) Per-scope auth throttle overrides as a JSON object. null disables a scope.
Database & cache
KARNI_CACHE KARNI_CACHE "redis" redis (the default cache at REDIS_URL) or locmem, an in-process cache for a host run without Redis (development only: throttle counters are then per process).
KARNI_SINGLE_PROCESS KARNI_SINGLE_PROCESS False A deployment of one process, without Redis or a Celery worker: the cache in memory (KARNI_CACHE=locmem), Celery tasks run in the process that sends them (CELERY_TASK_ALWAYS_EAGER, broker memory://), /readyz and /health/ready/ leave the broker and the worker out, and karni.W501 is quiet while WEB_CONCURRENCY is 1. Each only where the project sets no value of its own. Beat does not run: no scheduled task fires. See a small server.
Email
KARNI_MAIL_DISABLED_KINDS KARNI_MAIL_DISABLED_KINDS [] Experimental. The kinds of email karni.mail does not send, by name (commerce.new_order). A kind is the stable name a part gives each email.
KARNI_MAIL_SOURCE KARNI_MAIL_SOURCE "karni.notify.source.NotifySource" Experimental. Dotted path of the object (or class) karni.mail asks what a business changed: template(kind) (an email edited in the app), enabled(kind), sender() and, optionally, send(...), which takes over the delivery of every message with a kind. The default, karni.notify.source.NotifySource, keeps edited emails, each person's switches and unsubscribes and the inbox while karni.notify is installed, and reads the files and the preferences contract otherwise. Blank: karni.mail.DefaultSource. See notifications.
Files & storage
KARNI_STORAGE KARNI_STORAGE "local" local (filesystem) or s3 (any S3-compatible service, needs karni[s3]).
KARNI_STATIC_STORAGE KARNI_STATIC_STORAGE "plain" The static files' storage (STORAGES['staticfiles']): plain (the default, the names as written), manifest (karni.storage.static.ManifestStaticStorage: collectstatic gives each file a name with a hash of its content, {% static %} names it, and a web server may let browsers keep it a year, while a file missing from the manifest gets its plain name instead of a failed page) or a dotted path. New site projects set manifest in their production .env. See static and media files.
API (karni.api)
KARNI_SEARCH_PROVIDER KARNI_SEARCH_PROVIDER "karni.api.search.postgres.PostgresSearchProvider" Dotted path of the SearchProvider behind ?search=. The PostgreSQL provider falls back to portable search on other databases.
KARNI_API_MAX_EXPAND_DEPTH KARNI_API_MAX_EXPAND_DEPTH 2 Deepest ?expand= path allowed (levels of nesting).
KARNI_GLOBAL_SEARCH_MIN_LENGTH KARNI_GLOBAL_SEARCH_MIN_LENGTH 2 Experimental. The shortest query GET /api/search/ searches for. A shorter one answers no groups. See search across models.
KARNI_GLOBAL_SEARCH_LIMIT KARNI_GLOBAL_SEARCH_LIMIT 5 Experimental. Hits per model GET /api/search/ returns when the request does not say (?limit=).
KARNI_GLOBAL_SEARCH_MAX_LIMIT KARNI_GLOBAL_SEARCH_MAX_LIMIT 20 Experimental. The most hits per model a request may ask for. A larger ?limit= is lowered to it.
KARNI_GLOBAL_SEARCH_THRESHOLD KARNI_GLOBAL_SEARCH_THRESHOLD 0.3 Experimental. The trigram similarity (0 to 1) a row needs on PostgreSQL to match without containing the query. pg_trgm's own pg_trgm.similarity_threshold (0.3) is the floor: the index answers it first.
KARNI_API_ROUTER KARNI_API_ROUTER "karni.api.routers.get_default_router" Zero-argument factory returning the router karni.api.urls exposes.
KARNI_PUBLIC_CREATE_RATE KARNI_PUBLIC_CREATE_RATE "10/hour" The limit on each caller (the user, else the client IP) of a create anyone may call (create=Public()), unless the viewset declares throttle = Throttle(create=...). None or "" turns this default off. See rate limits.
KARNI_PUBLIC_CREATE_HONEYPOT_FIELD KARNI_PUBLIC_CREATE_HONEYPOT_FIELD "homepage" Name of the hidden form field on a public create. A request that fills it is answered 202 and nothing is saved. Off for a model that has a field of that name. "" turns it off. See rate limits.
Performance (ADR 0001 Decision 3)
KARNI_MAX_PAGE_SIZE KARNI_MAX_PAGE_SIZE 100 Hard cap on ?page_size= for every Karni paginator.
KARNI_MAX_PAGE_SIZE_FLOOR KARNI_MAX_PAGE_SIZE_FLOOR 25 The lowest value KARNI_MAX_PAGE_SIZE may take (the frontend's page size).
KARNI_QUERY_BUDGET { "list": 8, "retrieve": 8, "create": 12, "update": 12, "partial_update": 12, "destroy": 10, "*": 15} Queries allowed per BaseViewSet action ("*" for any other), merged over the defaults. Set it per viewset with query_budget = Budget(...).
KARNI_QUERY_BUDGET_MODE KARNI_QUERY_BUDGET_MODE "off" off, warn (log an exceeded budget) or raise (fail the request, which is what the pytest plugin sets).
KARNI_QUERY_LOG KARNI_QUERY_LOG False Log each request's query count, duplicates and SQL time (QueryLogMiddleware).
KARNI_DEMO_MODE KARNI_DEMO_MODE env.bool("DEMO_MODE", default=False) Experimental. Turns demo mode on: only the demo accounts write, the data resets every KARNI_DEMO_RESET_HOURS hours, the sign-in pages list the accounts (GET /api/demo/). Also DEMO_MODE. Needs karni.demo in INSTALLED_APPS and its two middlewares. See demo mode.
KARNI_DEMO_ACCOUNTS KARNI_DEMO_ACCOUNTS [] Experimental. The demo accounts, one per role: [{"login": "customer@example.com", "label": "Customer", "can": "Place orders.", "roles": ["customer"]}]. Keys: login, label, can, roles (a list or "all"), staff, superuser, password. Empty: the one account karni seed makes. Reported by E950.
KARNI_DEMO_SEED KARNI_DEMO_SEED env.int("DEMO_SEED", default=42) Experimental. The fixed seed every demo reset uses, so the data is the same each time. Also DEMO_SEED.
KARNI_DEMO_RESET_HOURS KARNI_DEMO_RESET_HOURS env.int("DEMO_RESET_HOURS", default=24) Experimental. Hours between two demo resets, and how old data may be at boot. Also DEMO_RESET_HOURS.
KARNI_DEMO_RESET_CHECK_SECONDS KARNI_DEMO_RESET_CHECK_SECONDS 60 Experimental. How often a worker asks whether a demo reset is due. One worker resets, under a lock.
KARNI_DEMO_RESET_STAMP KARNI_DEMO_RESET_STAMP env("DEMO_RESET_STAMP", default="") Experimental. The file that records the last demo reset. Empty: next to the SQLite database, else <BASE_DIR>/data/demo-reset.json. Also DEMO_RESET_STAMP.
KARNI_DEMO_APP_INDEX KARNI_DEMO_APP_INDEX env("DEMO_APP_INDEX", default="") Experimental. The built React app's index.html that karni.demo.urls.app_urls() serves. Empty: <BASE_DIR>/frontend/dist/index.html. Also DEMO_APP_INDEX.
KARNI_DEMO_KEEP_APPS None Experimental. App labels whose rows a demo reset keeps. None: the accounts, roles, content types, sessions, the token blacklist and the beat schedule.
KARNI_DEMO_OPEN_PATHS [] Experimental. Paths anyone may write to in demo mode, besides sign-in, refresh, sign-out and accept-terms. An exact path or a prefix ending in *, for example ["/api/contact/*"].
KARNI_DEMO_LOCKED_PATHS [] Experimental. Paths no demo account may write to, besides the accounts API and the admin's user and role tables. Same pattern rule as KARNI_DEMO_OPEN_PATHS.
KARNI_DEMO_APP_RESERVED [] Experimental. First path segments the demo's React page never answers, added to api, health, the admin, static and media, for example ["payments"].
KARNI_DEMO_WRITE_RULE "" Experimental. Dotted path of f(request) -> Refusal \| None that replaces karni.demo.guard.refusal.
KARNI_DEMO_SEEDER "" Experimental. Dotted path of f(seed: int) -> str that reseeds the emptied tables on a demo reset. Empty: karni seed --reset with the fixed seed.
KARNI_SEED_LOGINS KARNI_SEED_LOGINS {} Extra karni seed logins with their roles, as JSON: {"organizer@example.com": ["organizer"]}.
KARNI_API_CACHE KARNI_API_CACHE False Cache BaseViewSet list and retrieve responses, invalidated on every write. See response caching.
KARNI_API_CACHE_TTL KARNI_API_CACHE_TTL 300 Seconds a cached response lives.
KARNI_API_CACHE_ALIAS KARNI_API_CACHE_ALIAS "default" The Django cache alias responses are stored in.
KARNI_AGGREGATE_MAX_GROUPS KARNI_AGGREGATE_MAX_GROUPS 1000 Experimental. The most groups one GET <resource>/aggregate/ returns. A request that makes more is refused (E387): send top or narrow it with filters. See aggregations.
KARNI_API_CACHE_FLUSH KARNI_API_CACHE_FLUSH None A daily full flush of the response cache through Celery beat: "HH:MM", or "HH:MM Area/City" for a timezone other than Celery's. None (the default) schedules nothing.
KARNI_API_CACHE_LEGACY_HEADER KARNI_API_CACHE_LEGACY_HEADER True Also send the deprecated X-Karni-Cache header, with a deprecation warning once per process. X-Cache replaces it. Set it to False once nothing reads the old header. Removed with the header in 1.0.
Admin (karni.admin + django-unfold)
KARNI_ADMIN_AUTODISCOVER KARNI_ADMIN_AUTODISCOVER True Register every unregistered model in the admin at startup (karni.admin).
KARNI_ADMIN_GRANTS_OPEN_PAGES KARNI_ADMIN_GRANTS_OPEN_PAGES True A role's grant (app.model:<action>) opens that model's admin page for that action, inside the grant's scope. False restores the 0.4.0 rule: only Django's model permissions open pages. Signing in to the admin still needs is_staff. See admin.
KARNI_GENERATOR KARNI_GENERATOR "Karni" The <meta name="generator"> value Karni's public pages carry ({% karni_seo %}), so tools that list a site's technologies see Karni. It names no version on purpose. "" turns it off and keeps a design's own tag.
KARNI_ADMIN_LOGO KARNI_ADMIN_LOGO env("KARNI_ADMIN_LOGO", default="") or None Logo for the admin header and login: karni for Karni's mark, or {"light": <static path>, "dark": ..., "icon": ...}. Leaving it unset keeps the text header. See admin.
KARNI_THEME_CSS KARNI_THEME_CSS "frontend/src/karni-theme.css" The project's karni-theme.css (relative to the project root, or absolute), the file karni ui detect writes for the staff app. The admin loads it too, so one file holds the brand. "" turns it off. See theming.
KARNI_ADMIN_PATH KARNI_ADMIN_PATH "admin/" URL path the scaffold mounts the Django admin at (trailing slash). Set it to something unguessable in production.
KARNI_ADMIN_EXCLUDE KARNI_ADMIN_EXCLUDE [ "sessions", "contenttypes", "admin", "auth.Permission", "django_celery_results.ChordCounter"] App labels or app_label.ModelName entries the admin leaves out.
KARNI_ADMIN_BULK_EDIT_MAX KARNI_ADMIN_BULK_EDIT_MAX 500 The most rows the admin's Edit selected action changes at once. A larger selection gets a message and nothing changes. See admin.
KARNI_ADMIN_GUIDE KARNI_ADMIN_GUIDE True Show the Getting started panel on the admin home page, and its entry in the user menu. A user can dismiss it. See admin.
KARNI_ADMIN_PER_PAGE KARNI_ADMIN_PER_PAGE 25 Rows per page on every admin list (25). A model sets its own with AdminMeta.per_page, and a reader picks 25, 50 or 100 with ?per_page=. See admin.
KARNI_ADMIN_COUNT_ESTIMATE_ABOVE KARNI_ADMIN_COUNT_ESTIMATE_ABOVE 100000 On PostgreSQL, a table above this many rows shows an estimated count ("about 1,200,000") instead of running COUNT(*) on every page. 0 always counts exactly. See admin.
KARNI_ADMIN_LIST_DISPLAY_MAX 6 Columns a derived admin changelist shows at most.
KARNI_ADMIN_LIST_FILTER_MAX 6 Sidebar filters a derived admin shows at most.
KARNI_ADMIN_SEARCH_MAX 5 Fields a derived admin searches at most.
KARNI_ADMIN_SITE "django.contrib.admin.site" Dotted path of the admin site models are registered on.
KARNI_ADMIN_BASE "unfold.admin.ModelAdmin" Dotted path of the ModelAdmin every derived admin is built on.
KARNI_MATRIX_EXCLUDE KARNI_MATRIX_EXCLUDE [ "admin", "auth", "contenttypes", "sessions", "sites", "django_celery_beat", "django_celery_results", "token_blacklist", "django_otp", "otp_totp", "otp_static", "account", "socialaccount", "karni_admin", "karni_audit", "karni_transfer", "karni_outbox", "karni_accounts.OneTimeToken", "karni_accounts.Permission", "karni_accounts.SocialIdentity", "karni_accounts.LoginCode"] App labels or app_label.ModelName entries the permission matrix leaves out (framework internals by default).
Security headers (karni.security)
KARNI_CSP KARNI_CSP {} Directives merged into the Content-Security-Policy every response carries, as a dict (JSON in the environment): sources are added, None removes a directive, e.g. {"font-src": ["https://fonts.gstatic.com"]}. None sends no policy. See security headers.
KARNI_CSP_REPORT_ONLY KARNI_CSP_REPORT_ONLY None True sends the policy as Content-Security-Policy-Report-Only (reported, not enforced), False enforces it. None follows DEBUG.
KARNI_PERMISSIONS_POLICY KARNI_PERMISSIONS_POLICY {} Browser features merged into the Permissions-Policy header, each with the origins allowed to use it, e.g. {"geolocation": ["self"]}. None removes a feature. None as the whole value sends no header.
Karni knobs
KARNI_HEALTH_CHECKS KARNI_HEALTH_CHECKS [ "karni.health.checks.check_database", "karni.health.checks.check_cache", "karni.health.checks.check_celery"] Dotted paths of the checks /health/ready/ runs (database, cache, Celery by default), comma-separated in the environment. A deployment without a Celery worker leaves karni.health.checks.check_celery out.
KARNI_HEALTH_CELERY_TIMEOUT 1.0 Seconds the readiness check waits for a Celery worker to answer.
KARNI_READYZ_CHECKS KARNI_READYZ_CHECKS [ "karni.health.checks.check_database", "karni.health.checks.check_cache", "karni.health.checks.check_broker"] Dotted paths of the checks /readyz runs: the database, the cache and the Celery broker by default, comma-separated in the environment. Experimental. See deploy.
KARNI_HEALTH_TIMEOUT KARNI_HEALTH_TIMEOUT 3.0 Seconds each readiness check may take before it counts as failed (/readyz and /health/ready/). Experimental.
KARNI_LOG_QUIET_PATHS KARNI_LOG_QUIET_PATHS ["/healthz", "/readyz", "/health/"] Paths whose healthy requests the request log skips, comma-separated in the environment (/healthz, /readyz and /health/ by default). A request that answers 400 or more is still logged. Empty logs all. Experimental.
API versions (karni.api.versions, experimental)
KARNI_API_VERSION KARNI_API_VERSION "" The current API version, such as v1: the API is mounted at /api/v1/ when config/urls.py uses karni.api.versions.api_urls(). Empty (the default) leaves the API unversioned. Experimental. See API versions.
KARNI_API_VERSIONS KARNI_API_VERSIONS {} More versions and what to say about them, as a dict (JSON in the environment): {"v0": {"deprecated": "2026-06-01", "sunset": "2027-01-31", "notes": "https://..."}, "v2": {"router": "myproject.api.v2_router"}}. A deprecated version sends Deprecation, Sunset and Link headers. Experimental. See API versions.
KARNI_API_UNVERSIONED KARNI_API_UNVERSIONED "keep" What /api/ without a version does once a version is set: keep (the default, it serves the current version), redirect (308 to the current version) or remove (404). Experimental. See API versions.
KARNI_THUMBNAILER "karni.storage.thumbnails.make_thumbnail" Dotted path of the function karni.storage.thumbnails renders thumbnails with.
KARNI_VALIDATE True Validate the merged settings at startup (karni.conf.validation). False skips it.
KARNI_PHONE_COUNTRY_CODE KARNI_PHONE_COUNTRY_CODE None The country code a national phone number gets in a PhoneField (digits, e.g. "44"): "01234 000 111" is stored as +441234000111. Unset, only international numbers (+ or 00) are accepted. See fields.
KARNI_PHONE_TRUNK_PREFIX KARNI_PHONE_TRUNK_PREFIX "0" The prefix a national number loses before the country code goes in front ("0", "1" in North America, "8" in Russia, "" where the number is dialled as written, as in Italy).
KARNI_PHONE_NORMALIZER "karni.fields.text.default_phone_normalizer" Dotted path of the function a PhoneField, its form field and its API field clean a number with: it takes the value as typed and returns E.164, or the value unchanged to reject it. karni.fields.to_e164 holds Karni's rules for your own function.
Import and export (karni.transfer)
KARNI_IMPORT_INLINE_ROWS KARNI_IMPORT_INLINE_ROWS 500 Files with at most this many rows import inside the request. Larger ones run in Celery with progress.
KARNI_IMPORT_MAX_ROWS KARNI_IMPORT_MAX_ROWS 100_000 An upload with more rows than this is refused (E803). Split the file.
KARNI_EXPORT_MAX_ROWS KARNI_EXPORT_MAX_ROWS 100_000 An export with more rows than this is refused (E803). Narrow the filters.
Change history (karni.audit)
KARNI_AUDIT_ASYNC KARNI_AUDIT_ASYNC False Write change-history entries from a Celery task instead of inside the request (history becomes eventually consistent). See change history.
KARNI_AUDIT_RETENTION_DAYS KARNI_AUDIT_RETENTION_DAYS None Days of change history to keep. None (the default) keeps everything and schedules no pruning.
KARNI_AUDIT_REDACT KARNI_AUDIT_REDACT ["password", "token", "secret", "key"] Field-name substrings whose values are never recorded in change history, only that they changed (default password,token,secret,key).
Request ids and development capture (karni.tracing / karni.debug)
KARNI_REQUEST_ID_TRUST_HEADER KARNI_REQUEST_ID_TRUST_HEADER False Accept a client's X-Request-ID as the request id with DEBUG off. Turn it on only when the proxy in front overwrites the header on every request. It is ignored when NUM_PROXIES is 0. See capture.
KARNI_REQUEST_ID_EMAILS True Stamp X-Karni-Request-ID on every outgoing email (wraps EmailMessage.send) and trace the send in development.
KARNI_DEBUG_CAPTURE KARNI_DEBUG_CAPTURE True With DEBUG on, record requests, failures and a trace under .karni/ for karni trace, karni replay and karni explain --failure. False turns it off, and with DEBUG off it never runs. See capture.
KARNI_DEBUG_CAPTURE_KEEP KARNI_DEBUG_CAPTURE_KEEP 200 How many request records, and how many failure snapshots, .karni/ keeps (the oldest go first).
KARNI_DEBUG_TRACE_DAYS KARNI_DEBUG_TRACE_DAYS 7 Days of .karni/trace/ files to keep.
Events & schedules (karni.events / karni.schedule)
KARNI_EVENTS_AUTODISCOVER KARNI_EVENTS_AUTODISCOVER True Import every app's events.py and listeners.py at startup.
KARNI_SCHEDULES_AUTODISCOVER KARNI_SCHEDULES_AUTODISCOVER True Import every app's schedules.py at startup.
KARNI_EVENTS_DISPATCHER "karni.outbox.dispatch.celery" Experimental. Dotted path of the function that hands a committed family event to a worker: (event_id, *, countdown=0). The default queues a Celery task, and the sweep sends what a down broker refused. See family events.
KARNI_EVENTS_INLINE KARNI_EVENTS_INLINE None Experimental. Whether the default dispatcher delivers a committed family event in the process that committed, with no worker: None (the default) follows DEBUG, so development fills the timeline and the inbox at once, True for a small deployment that runs no broker, False keeps Celery. A KARNI_EVENTS_DISPATCHER of your own is used either way. See family events.
KARNI_EVENTS_MAX_ATTEMPTS KARNI_EVENTS_MAX_ATTEMPTS 8 Experimental. Runs of one family event delivery before it is marked failed (1 to 100). Retries wait 10 seconds, then four times longer each time, at most 6 hours.
KARNI_EVENTS_RETENTION_DAYS KARNI_EVENTS_RETENTION_DAYS 30 Experimental. Days a delivered family event stays in the outbox. Events with a pending or failed delivery stay. None keeps them all and schedules no pruning.
KARNI_PK "uuid" Experimental. The primary key karni make model writes: uuid (BaseModel) or bigint (BigIntBaseModel). The CLI reads it from a plain KARNI_PK = "bigint" line in config/settings.py, and --pk overrides it per model. Nothing else reads it: each model's class line decides its key. See choosing the key type.
KARNI_ARCHITECTURE { "skip_apps": [], "sql_allowed": ["*/sql/*", "*/migrations/*"], "http_allowed": ["*/services/*", "*/providers/*", "*/tests/*", "conftest.py"], "dup": {"min_statements": 8, "exclude": ["*/migrations/*"]}} Configuration of the architecture rules: skip_apps, sql_allowed, http_allowed, dup. See enforcement.
KARNI_CHECK_CACHE True Experimental. karni check keeps each file check's results under the file's hash in .karni/local/check-cache.json, so an unchanged file is not checked again. False turns it off, a path (relative to the project root) moves it. See the check cache.
KARNI_SUGGESTIONS True Experimental. karni check and karni doctor print suggestions after the errors and warnings: what Karni could do that the project does by hand, with the file, line and fix (SUG001 to SUG007). They never fail a run. False turns them off for the project. The CLI reads a plain KARNI_SUGGESTIONS = False line in config/settings.py. See suggestions.
KARNI_SCALING_ROWS [2, 12] Experimental. The two row counts the scaling check compares, small then large. A viewset's query_scaling = Scaling(rows=..., seconds=...) overrides them and sets a time budget. See the scaling check.
KARNI_SEED_BULK_THRESHOLD 1000 Experimental. Rows per model from which karni seed inserts in bulk (a large seed count of karni.yaml). karni seed --volume always does. See volume seeding.
KARNI_SEED_BATCH_SIZE 2000 Experimental. Rows per bulk insert of karni seed (--batch-size overrides it).
KARNI_SEED_LEDGER True Experimental. karni seed records the row count each table holds after a run in .karni/local/seeded.json, and --volume refuses a table holding rows no seed run left there. False turns it off, a path moves it.
KARNI_EXPLAIN_SEQ_SCAN_ROWS 1000 Experimental. karni queries --explain flags each sequential scan on a table of this many rows or more, with the index that would serve it (PostgreSQL).
KARNI_RULES_CLOCK_SKEW 300 Experimental. Seconds a $now bound of class Karni: bounds forgives, so a browser clock a little ahead or behind the server is not refused. See rules.

Settings listed as computed derive from others. The defaults of env-backed settings are what an absent variable yields. KARNI_VALIDATE checks the merged values at startup and reports every bad one at once (error E504).

Module settings

Each module adds its own settings through the karni.settings entry point, read from its conf.py. They apply once the module is installed (karni add <module>). Assign them in config/settings.py. A module's README says more about each. karni explain <SETTING> prints any setting on this page.

karni-ai

Setting Env Default What it does
KARNI_AI_PROVIDER KARNI_AI_PROVIDER "" The provider: "anthropic", "openai", "test" (deterministic, no network), or the dotted path of a karni_ai.providers.base.Provider subclass. Empty until a project sets it: karni check fails (AI001) without one.
KARNI_AI_TIMEOUT KARNI_AI_TIMEOUT 60 Whole seconds one provider call may take before it fails (AI006).
KARNI_AI_MAX_RETRIES KARNI_AI_MAX_RETRIES 1 Retries of a provider call that failed on a rate limit, an overload or the network.
KARNI_AI_MAX_OUTPUT_TOKENS KARNI_AI_MAX_OUTPUT_TOKENS 16000 The most tokens one answer may use. A longer answer is cut off (AI007).
KARNI_AI_MAX_ROWS KARNI_AI_MAX_ROWS 50 Rows kept from one answer. The rest are left out, with a problem.
KARNI_AI_MAX_SOURCE_CHARS KARNI_AI_MAX_SOURCE_CHARS 100_000 The longest source text, in characters. A longer one is refused (AI010).
KARNI_AI_MAX_UPLOAD_BYTES KARNI_AI_MAX_UPLOAD_BYTES 10 * 1024 * 1024 The largest PDF upload, in bytes (AI010).
KARNI_AI_MAX_PDF_PAGES KARNI_AI_MAX_PDF_PAGES 50 The most pages read from one PDF (AI010).
KARNI_AI_FETCH_TIMEOUT KARNI_AI_FETCH_TIMEOUT 10 Whole seconds a URL fetch may take: connecting, redirects and reading (AI012).
KARNI_AI_FETCH_MAX_BYTES KARNI_AI_FETCH_MAX_BYTES 5 * 1024 * 1024 The largest response a URL fetch reads, in bytes (AI012).
KARNI_AI_FETCH_MAX_REDIRECTS KARNI_AI_FETCH_MAX_REDIRECTS 3 Redirects a URL fetch follows, each checked like the first address (AI011).
KARNI_AI_FETCH_PORTS KARNI_AI_FETCH_PORTS [80, 443] The ports a URL may name (AI011).
KARNI_AI_FETCHER KARNI_AI_FETCHER "karni_ai.services.fetch.Fetcher" The dotted path of the class that fetches a URL (karni_ai.services.fetch.Fetcher).
KARNI_AI_EXTRACTOR KARNI_AI_EXTRACTOR "karni_ai.extraction.Extractor" The dotted path of the class that runs an extraction (karni_ai.extraction.Extractor).
KARNI_AI_PRICES {} Prices per million tokens, by model name: {"": {"input": "1.00", "output": "4.00"}}. A model missing from the table logs no cost.
KARNI_AI_MONTHLY_TOKENS_PER_USER KARNI_AI_MONTHLY_TOKENS_PER_USER None Tokens one user may spend in a calendar month (None: no budget, AI013).
KARNI_AI_MONTHLY_TOKENS KARNI_AI_MONTHLY_TOKENS None Tokens the whole project may spend in a calendar month (None: no budget, AI014).
ANTHROPIC_API_KEY ANTHROPIC_API_KEY "" The anthropic provider's API key. From the environment only (AI004).
ANTHROPIC_MODEL ANTHROPIC_MODEL "" The model the anthropic provider asks. No default: name one (AI005).
OPENAI_API_KEY OPENAI_API_KEY "" The openai provider's API key. From the environment only (AI004).
OPENAI_MODEL OPENAI_MODEL "" The model the openai provider asks. No default: name one (AI005).

karni-approvals

Setting Env Default What it does
KARNI_APPROVALS_REQUIRED KARNI_APPROVALS_REQUIRED 1 Approvals a pending change needs before it is applied (per model: approvals_required).
KARNI_APPROVALS_APPROVER_ROLES KARNI_APPROVALS_APPROVER_ROLES [] Roles that may approve, on top of holding the approve permission. An empty list means any holder of karni_approvals.pendingchange:approve (per model: approver_roles).
KARNI_APPROVALS_TIMEOUT_HOURS KARNI_APPROVALS_TIMEOUT_HOURS 0 Hours before a pending change times out, or 0 for never (per model: approval_timeout).
KARNI_APPROVALS_ON_TIMEOUT KARNI_APPROVALS_ON_TIMEOUT "expire" What a timeout does: "expire" the change, or "escalate" (notify the escalation roles and extend by the same timeout). Per model: approval_on_timeout.
KARNI_APPROVALS_ESCALATION_ROLES KARNI_APPROVALS_ESCALATION_ROLES [] Roles notified on escalation (per model: approval_escalation_roles).
KARNI_APPROVALS_NOTIFY KARNI_APPROVALS_NOTIFY "karni_approvals.notify.email_checkers" Dotted path called as fn(pending_change) from the Celery task to notify the checkers. The default emails them. "" turns notification off.
KARNI_APPROVALS_FROM_EMAIL KARNI_APPROVALS_FROM_EMAIL "" Sender address for the default notifier, or "" to use DEFAULT_FROM_EMAIL.

karni-charts

Setting Env Default What it does
KARNI_CHARTS_READ KARNI_CHARTS_READ "authenticated" Who may read the chart definitions (/api/charts/): "authenticated" (the default), "public" (anyone, for charts on a public page) or "granted" (the roles' grants on karni_charts.chart). The data always follows the source resource's own access, whoever reads the definition.

karni-commerce

Setting Env Default What it does
KARNI_COMMERCE_CURRENCY KARNI_COMMERCE_CURRENCY "" The project's currency, as an ISO 4217 code. Blank (the default) takes KARNI_PAYMENTS_CURRENCY, so a project names its currency once.
KARNI_COMMERCE_HOLD_MINUTES KARNI_COMMERCE_HOLD_MINUTES 30 How long checkout holds an order's items for its payment, in minutes. An order not paid by then is cancelled and its items are free again.
KARNI_COMMERCE_MAX_QUANTITY KARNI_COMMERCE_MAX_QUANTITY 99 The most of one item a cart line takes.
KARNI_COMMERCE_FIRST_NUMBER KARNI_COMMERCE_FIRST_NUMBER 1001 The number of the first order. Later orders count up from it.
KARNI_COMMERCE_NUMBER KARNI_COMMERCE_NUMBER "" The dotted path of the function that gives a new order its number: number(order) -> int. Blank (the default) counts up from KARNI_COMMERCE_FIRST_NUMBER (karni_commerce.services.next_number).
KARNI_COMMERCE_ORDER_PATH KARNI_COMMERCE_ORDER_PATH "/orders/{number}?key={key}" Where a person reads an order in the app, after KARNI_FRONTEND_URL: {number} and {key} (the guest's secret) are filled in. The payment's return address and the emails' links point here.
KARNI_COMMERCE_MANUAL_HOLD_MINUTES KARNI_COMMERCE_MANUAL_HOLD_MINUTES 2880 How long an order staff place by hand (a phone order) holds its items for the buyer's payment, in minutes. Two days by default.
KARNI_COMMERCE_STAFF_EMAILS KARNI_COMMERCE_STAFF_EMAILS [] Who gets the new-order email (commerce.new_order): a list of addresses. Empty (the default) sends none.
KARNI_COMMERCE_OTHER_CHECKOUT_VALIDATOR KARNI_COMMERCE_OTHER_CHECKOUT_VALIDATOR "karni_payments.services.default_checkout_validator" The checkout validator for payments that are not an order's (the dotted path karni_commerce.payments.checkout_validator hands them to).
KARNI_COMMERCE_PRICES_INCLUDE_TAX KARNI_COMMERCE_PRICES_INCLUDE_TAX False Whether the prices the sellables give include their tax. Off (the default): tax is added on top at checkout. On: the tax is the part of each price that is tax, and the total is the prices (with the discount and shipping).
KARNI_COMMERCE_SHIPPING KARNI_COMMERCE_SHIPPING "karni_commerce.pricing.ZoneShipping" The dotted path of the class that gives the shipping methods of an address (karni_commerce.pricing.ZoneShipping: the zones and methods staff set up).
KARNI_COMMERCE_TAX KARNI_COMMERCE_TAX "karni_commerce.pricing.RateTax" The dotted path of the class that gives the tax rate of a tax class at an address (karni_commerce.pricing.RateTax: the rates staff set up).
KARNI_COMMERCE_SELLABLES {} Sellable adapters by kind, as dotted paths, over the ones the apps register in their sellables.py: {"product": "myapp.sellables.MyProduct"}.
KARNI_COMMERCE_FIRST_INVOICE KARNI_COMMERCE_FIRST_INVOICE 1001 The first invoice's number (karni_commerce.services.issue_invoice).

karni-game

Setting Env Default What it does
KARNI_GAME_RATES The rates of the limited writes, by scope (docs/game-api.md, Rate limits). A project's dict is laid over these: {"score": "10/min"} changes one, None turns one off.
KARNI_GAME_TOKEN_HEADER KARNI_GAME_TOKEN_HEADER "X-Player-Token" The header a guest sends its token in.
KARNI_GAME_CORS_ORIGINS KARNI_GAME_CORS_ORIGINS [] The origins a portal build calls the game API from (https://games.example), or "*". Only /api/game/, only with a token (X-Player-Token or a JWT), never with cookies.
KARNI_GAME_SERVER_SECRET KARNI_GAME_SERVER_SECRET "" The secret a realtime server of the project's own shares: it signs the player tokens Karni issues (HS256) and the results the server reports. Blank: no multiplayer (karni.GAME027 when a client asks for a token).
KARNI_GAME_TOKEN_ISSUER KARNI_GAME_TOKEN_ISSUER "karni-game" The iss claim of the player token.
KARNI_GAME_TOKEN_SECONDS KARNI_GAME_TOKEN_SECONDS 300 How long a player token for the realtime server lives, in seconds.
KARNI_GAME_PORTALS {} Portals that call back when an ad was watched: {name: {"secret": "...", "verifier": "dotted.path.Verifier"}}. The verifier defaults to karni_game.signatures.HmacVerifier (X-Karni-Timestamp and X-Karni-Signature).
KARNI_GAME_SIGNATURE_TOLERANCE KARNI_GAME_SIGNATURE_TOLERANCE 300 How far a signed request's timestamp may be from the server's clock, in seconds.
KARNI_GAME_CLIENT_CLAIMS_PER_DAY KARNI_GAME_CLIENT_CLAIMS_PER_DAY 5 The most claims a day of an ad reward the client claims (trust "client"): any client can claim it, so it stays low. A reward's per_day may be lower, never higher.
KARNI_GAME_AD_INTENT_SECONDS KARNI_GAME_AD_INTENT_SECONDS 3600 How long an ad reward's intent token (POST rewards//intent/) is valid, in seconds.
KARNI_GAME_INTENT_DAYS KARNI_GAME_INTENT_DAYS 7 How many days a write's intent (the retry key) is kept.
KARNI_GAME_MAX_SAVE_BYTES KARNI_GAME_MAX_SAVE_BYTES 1024 * 1024 The largest save any game may allow, in bytes (a game's max_save_bytes stays below it).
KARNI_GAME_PLAYED_AT_WINDOW KARNI_GAME_PLAYED_AT_WINDOW 86400 How far back a score's played_at (when it was played, offline) is trusted, in seconds. A score played before midnight and sent after lands on the board of the day it was played. Older is GAME036. A played_at more than a minute ahead of the server is too.
KARNI_GAME_MAX_RUN_BYTES KARNI_GAME_MAX_RUN_BYTES 256 * 1024 The largest run record (seed, input log, meta) a score may carry, in bytes.
KARNI_GAME_MERGER KARNI_GAME_MERGER "karni_game.merge.Merger" The class that merges two players (an upgrade, or two people merged): a subclass of karni_game.merge.Merger.
KARNI_GAME_DAILY_SEED KARNI_GAME_DAILY_SEED "karni_game.daily.daily_seed" The function that gives a game's seed of a day: seed(game, day) -> int.
KARNI_GAME_AUTODISCOVER KARNI_GAME_AUTODISCOVER True Import /game.py of every installed app at startup (save migrations, run checks).
KARNI_GAME_ROLES KARNI_GAME_ROLES True Declare the roles game-manager and game-moderator (the karni.roles entry point).

karni-impersonation

Setting Env Default What it does
KARNI_IMPERSONATION_MAX_MINUTES KARNI_IMPERSONATION_MAX_MINUTES 60 Hard limit on an impersonated session, which ends by itself after this.
KARNI_IMPERSONATION_BLOCKED KARNI_IMPERSONATION_BLOCKED DEFAULT_BLOCKED Actions, models, permissions and paths blocked while impersonating.
KARNI_IMPERSONATION_REQUIRE_REASON KARNI_IMPERSONATION_REQUIRE_REASON True A reason string is required to start (default on: this is customer data).
KARNI_IMPERSONATION_NOTIFY_TARGET KARNI_IMPERSONATION_NOTIFY_TARGET True Email the impersonated user when a session starts (default on).
KARNI_IMPERSONATION_FROM_EMAIL KARNI_IMPERSONATION_FROM_EMAIL "" Sender address for that email, or "" to use DEFAULT_FROM_EMAIL.
KARNI_IMPERSONATION_BANNER KARNI_IMPERSONATION_BANNER True Inject the banner into every HTML page served to an impersonated session.
KARNI_IMPERSONATION_LANDING KARNI_IMPERSONATION_LANDING "/" Where the admin's Impersonate button sends the impersonator afterwards.

karni-payments

Setting Env Default What it does
KARNI_PAYMENTS_PROVIDER KARNI_PAYMENTS_PROVIDER "stripe" Active provider: "stripe", "razorpay", "test" or any dotted path to a karni_payments.providers.base.PaymentProvider subclass (the escape hatch for custom gateways).
KARNI_PAYMENTS_CURRENCY KARNI_PAYMENTS_CURRENCY "usd" Default ISO currency code used when create_checkout gets none.
KARNI_PAYMENTS_CHECKOUT_VALIDATOR "karni_payments.services.default_checkout_validator" Dotted path called with (user=, amount=, currency=, metadata=) BEFORE a Payment is created. It is the server-side pricing authority. The default is a pass-through, and production projects should replace it (never trust client amounts).
KARNI_PAYMENTS_EVENT_HANDLER "karni_payments.services.apply_event" Dotted path of the webhook state machine applied by the Celery task.
KARNI_PAYMENTS_ALLOWED_REDIRECTS KARNI_PAYMENTS_ALLOWED_REDIRECTS [] Extra URLs whose origins are allowed as checkout success/cancel redirects, on top of KARNI_FRONTEND_URL's origin.
KARNI_PAYMENTS_TEST_CHECKOUT_PAGE None The test provider's checkout page (experimental): True serves it at payments/test-checkout//, where a person pays or declines a test payment in the browser. None (the default) serves it while DEBUG is on. False keeps the imaginary https://checkout.test/ address.
STRIPE_SECRET_KEY STRIPE_SECRET_KEY "" Provider credentials: blank by default, validated lazily at use.
STRIPE_WEBHOOK_SECRET STRIPE_WEBHOOK_SECRET "" Provider credentials: blank by default, validated lazily at use.
RAZORPAY_KEY_ID RAZORPAY_KEY_ID "" Provider credentials: blank by default, validated lazily at use.
RAZORPAY_KEY_SECRET RAZORPAY_KEY_SECRET "" Provider credentials: blank by default, validated lazily at use.
RAZORPAY_WEBHOOK_SECRET RAZORPAY_WEBHOOK_SECRET "" Provider credentials: blank by default, validated lazily at use.

karni-reports

Setting Env Default What it does
KARNI_REPORTS_RENDERER KARNI_REPORTS_RENDERER "weasyprint" Turns HTML into PDF: "weasyprint", "fake" (deterministic bytes, no system libraries: for tests) or the dotted path of a karni_reports.rendering.Renderer subclass.
KARNI_REPORTS_STORAGE KARNI_REPORTS_STORAGE "default" The STORAGES alias the files are saved to.
KARNI_REPORTS_DIRECTORY KARNI_REPORTS_DIRECTORY "karni/reports" The folder inside that storage. Each report gets a folder of its own under it.
KARNI_REPORTS_PAGE_SIZE KARNI_REPORTS_PAGE_SIZE "A4" The CSS page size the base template prints on: "A4", "letter", "A5 landscape"...
KARNI_REPORTS_KEEP KARNI_REPORTS_KEEP 1 Ready files kept per report and row, the newest first. Older files and their rows are deleted after each render. 0 keeps every file.
KARNI_REPORTS_RENDER_TIMEOUT KARNI_REPORTS_RENDER_TIMEOUT 600 Seconds after which a report still pending or rendering is queued again by the next request (a worker that died mid-render).

karni-site

Setting Env Default What it does
KARNI_SITE_IS_ACTIVE "karni_site.navigation.is_active" The function {% ifactive %} asks whether a pattern names the current page: (request, pattern) -> bool. A dotted path, so a project can swap the rule.
KARNI_SITE_SERVER_ERROR_TEMPLATES ["500.html", "karni_site/500.html"] The templates karni_site.views.server_error tries in order. The first that renders is the page. The last is this module's plain page, which needs nothing.
KARNI_SITE_NOT_FOUND_TEMPLATES ["404.html", "karni_site/404.html"] The same for karni_site.views.page_not_found.
KARNI_SITE_SETTINGS_MODEL "karni_site.SiteSettings" The model site is in every template: "app_label.ModelName". A project with fields of its own subclasses karni_site.models.AbstractSiteSettings and names its model here, before karni_site's first migrate (like AUTH_USER_MODEL).
KARNI_SITE_HIGHLIGHT {"marker": "==", "tag": "mark", "class": ""} What a client types around words to highlight them, in an editable block and in a field rendered with {{ value|highlight }}, and the element (with its class) the words render in. A backslash before the marker keeps it as typed. An empty marker turns it off.
KARNI_SITE_INLINE_TAGS {"b": [], "strong": [], "i": [], "em": [], "br": [], "a": ["href", "title", "target", "rel"]} The inline markup an edited block keeps: element -> the attributes it keeps. Everything else is removed, its text kept. The highlight element joins it.
KARNI_SITE_LINK_SCHEMES ["http", "https", "mailto", "tel"] The schemes a link in an edited block may use. A relative link always may.
KARNI_SITE_SANITIZER "karni_site.sanitize.sanitize" The function that cleans a block's HTML: (html) -> html. A dotted path.
KARNI_SITE_IMAGE_TYPES ["jpg", "jpeg", "png", "gif", "webp", "avif", "ico"] The file types an image upload may be (by extension, checked against the file's own bytes). SVG is left out on purpose: an SVG file can carry script.
KARNI_SITE_CACHE "default" The cache alias blocks, menus, redirects, page SEO entries and the settings live in.
KARNI_SITE_CACHE_TIMEOUT 3600 Seconds a cached entry lives. Every save clears what it changed, so this is a backstop.
KARNI_SITE_SEED_ON_RENDER KARNI_SITE_SEED_ON_RENDER True Whether the first render of a template stores its defaults (blocks, a menu's seed, the site's details). False: nothing is written while a page renders.
KARNI_SITE_MENU_ROWS "karni_site.menus.menu_rows" The rows a menu item's "children from" model contributes: (model, item) -> iterable of rows with get_absolute_url(). A dotted path.
KARNI_SITE_MENU_ROWS_LIMIT 100 At most this many rows per "children from" item.
KARNI_SITE_MENU_SECTIONS True True: a menu item is active (item.active) on every page under its own path too, so "Services" at /services/ stays marked on /services/web/. The home page (/) never is. False: an item is active on its own page and when one of its children is.
KARNI_SITE_MENU_FOLLOW_SEED True True: a menu seeded from a template ({% get_menu ... seed="..." %}) follows it, as an editable block follows its text: the items nobody changed take the seed's new links. False: the seed makes the menu once and never changes it afterwards.
KARNI_SITE_REDIRECTS_BEFORE_VIEWS False False: an admin redirect answers only where the site has no page (a 404), and a request for a page that exists costs nothing. True: every request is looked up before the view runs, one cache read each.
KARNI_SITE_EDITOR_ROLE "editor" The slug of the content editor role this module declares (karni.roles), or None to declare none. A role of the same slug in KARNI_ROLES replaces it.
KARNI_SITE_FORMS {} Form name -> the dotted path of the BaseViewSet that saves it, or a model label ("shop.Enquiry"). Without an entry, {% karni_form "enquiry" %} finds the model by name.
KARNI_SITE_FORM_CLASS "karni_site.forms.SiteForm" The class that renders and submits a form. A dotted path to a karni_site.forms.SiteForm subclass, to change how fields are described or how a submission is saved.
KARNI_SITE_FORM_TEMPLATE "karni_site/forms/form.html" The template {% karni_form %} renders. Each field renders karni_site/forms/field.html, or karni_site/forms/
/.html or karni_site/forms//field.html when one exists.
KARNI_SITE_FORM_CLASSES {} Class names on the form's markup, merged over the module's plain defaults: form, row, column, field, label, input, select, check, check_input, check_label, invalid, error, help, message, success, failure, button, required.
KARNI_SITE_FORM_PRESETS {} Named sets of class names a tag picks with classes="", merged over the shipped "bootstrap" preset (Bootstrap 5). {"salon": {"field": "field", "row": "form-row"}}.
KARNI_SITE_FORM_MESSAGES {} The texts a form shows, merged over the defaults: success, invalid, throttled, refused, failed, choose (a select's empty option) and button. A tag's own success="..." wins.
KARNI_SITE_FORM_REQUIRED_MARK "*" The text after a required field's label.
KARNI_SITE_FORM_SCRIPT True Whether {% karni_form %} adds karni_site/forms.js (submit in place, inline errors). False leaves the form working without JavaScript, and a site may load its own script.
KARNI_SITE_FORM_SENT_PARAM "sent" The query parameter the page gets after a form was sent without JavaScript: ?sent=.
KARNI_SITE_FORM_PAGE_TEMPLATE "karni_site/forms/page.html" The page that shows a form with its errors when the page it was sent from cannot be rendered again (no page, a page that needs a POST, a page that fails).
KARNI_SITE_NOTIFY_FROM KARNI_SITE_NOTIFY_FROM "" The sender of karni_site.notify emails. Empty: Django's DEFAULT_FROM_EMAIL.
KARNI_SITE_URL KARNI_SITE_URL None The site's own address, "https://www.example.com". Canonical links, share tags, the sitemap and robots.txt use it. None: the address each request came to.
KARNI_SITE_ALLOW_INDEXING KARNI_SITE_ALLOW_INDEXING None Whether search engines may index the site. None: only when DJANGO_ENV is "prod", so a development or staging copy is never indexed. True or False decides for every environment.
KARNI_SITE_ROBOTS_TAG KARNI_SITE_ROBOTS_TAG "noindex, nofollow" What a closed site tells search engines on every page, while indexing is not allowed: the X-Robots-Tag header of every response (karni_site.middleware.RedirectMiddleware) and the robots meta tag of {% karni_seo %}. robots.txt alone is not enough: a proxy or CDN may rewrite it. "" sends neither, and robots.txt is then the only signal.
KARNI_SITE_ROBOTS_DISALLOW [] Paths robots.txt asks crawlers to stay out of while indexing is allowed: ["/search/"].
KARNI_SITE_SITEMAP_EXCLUDE [] URL names and paths the sitemap leaves out, shell wildcards allowed: ["website:thanks", "/drafts/*"]. The admin, the API and redirects are never in it.
KARNI_SITE_TECHNICAL_ROUTES [] URL names and paths added to Karni's own technical routes (the health and readiness probes, the welcome page), which no sitemap or menu choice lists: ["status", "/ping"].
KARNI_SITE_SITEMAPS "karni_site.sitemaps.sitemaps" The function that lists the sitemap's sections: () -> {name: Sitemap}. A dotted path.
KARNI_SITE_PUBLISHED_FIELDS ["published", "is_published", "is_public", "public", "visible", "is_visible"] Boolean fields that mark a row as public, tried in order on a model in the sitemap without a filter of its own (class Karni: sitemap = {"filter": {...}}).
KARNI_SITE_SCHEMA_TYPE "auto" The schema.org type of the site's JSON-LD: "auto" (LocalBusiness when the site has opening hours, else Organization), any schema.org type ("Bakery", "Dentist"), or None.
KARNI_SITE_JSONLD "karni_site.jsonld.build" The function that builds the JSON-LD: (request, site) -> dict or None. A dotted path.
KARNI_SITE_SEO_OBJECT "karni_site.metadata.page_object" The function that finds the object a page is about: (context, request) -> object or None.
KARNI_SITE_TITLE_FORMAT "{title} \| {site}" How a title taken from the page's object is written. {title} and {site}.
KARNI_SITE_DESCRIPTION_LENGTH 160 The longest description taken from the page's object, in characters.
KARNI_SITE_IMAGE_WIDTHS [320, 480, 640, 800, 960, 1280, 1600, 1920] The widths, in pixels, of the WebP copies made of each uploaded image (those below its own width, and its own width when it is not a WebP). [] makes none.
KARNI_SITE_IMAGE_QUALITY 80 The WebP quality of those copies, 1 to 100.
KARNI_SITE_IMAGE_MAX_SIZE 2560 An uploaded image wider or taller than this many pixels is scaled down to fit. None keeps it.
KARNI_SITE_QUEUE_RENDITIONS KARNI_SITE_QUEUE_RENDITIONS True Whether an upload, and the first page that shows an image without copies, queue the copies (a Celery task). False: make them yourself (karni_site.renditions.make).
KARNI_SITE_RENDITIONER "karni_site.renditions.generate" The function that makes an image's copies: (name, storage) -> manifest. A dotted path.
KARNI_SITE_IMAGE_STYLE ":where(img[data-karni-image]){height:auto}" ":where(img[data-karni-image=natural]){width:auto}" The CSS {% karni_seo %} puts in the head so an image Karni sized keeps its shape when the design's CSS sets only its width or only its height. "" leaves it out.
KARNI_SITE_SEO_MAX_PAGES 500 karni check --seo: at most this many pages are requested.
KARNI_SITE_SEO_IMAGE_BYTES 500_000 karni check --seo: an image without smaller copies is oversized above this many bytes.
KARNI_SITE_SEO_PIXEL_RATIO 2 karni check --seo: an image is oversized when wider than this many times its width.
KARNI_SITE_SEO_IGNORE [] karni check --seo: regular expressions of paths it never requests.
KARNI_SITE_SEO_QUIET ["django_structlog", "django.request", "django.server", "karni.queries"] karni check --seo: the loggers held back while it requests the pages (one or more lines per request). Their errors are counted, and the first is shown. [] keeps them.

karni-storage

Setting Env Default What it does
KARNI_STORAGE_PROVIDER KARNI_STORAGE_PROVIDER "aws" The S3-compatible service the files go to when KARNI_STORAGE is "s3": aws, r2, minio, spaces, b2 or gcs-interop (karni_storage.presets).
KARNI_STORAGE_CREDENTIALS KARNI_STORAGE_CREDENTIALS "keys" "keys": AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY must be set. "chain": boto3 finds them itself (an AWS instance or task role, a profile).
KARNI_STORAGE_BUCKET KARNI_STORAGE_BUCKET "" The bucket of protected files. Empty: AWS_STORAGE_BUCKET_NAME.
KARNI_STORAGE_LOCATION KARNI_STORAGE_LOCATION "protected" The key prefix of protected files inside the bucket.
KARNI_STORAGE_ROOT KARNI_STORAGE_ROOT "" The directory of protected files on local storage. Empty: "protected" next to MEDIA_ROOT, so the media URL never serves them.
KARNI_STORAGE_URL_EXPIRY KARNI_STORAGE_URL_EXPIRY 300 Seconds a signed download URL lives.
KARNI_STORAGE_UPLOAD_EXPIRY KARNI_STORAGE_UPLOAD_EXPIRY 900 Seconds a direct upload's presigned POST (or PUT) lives.
KARNI_STORAGE_UPLOAD_METHOD KARNI_STORAGE_UPLOAD_METHOD "" "post" or "put". Empty: the preset's (POST where the service takes a POST policy).
KARNI_STORAGE_MAX_SIZE KARNI_STORAGE_MAX_SIZE 10 * 1024 * 1024 The size limit of a protected field without max_size, in bytes (10 MiB).
KARNI_STORAGE_THUMBNAIL_SIZES KARNI_STORAGE_THUMBNAIL_SIZES {"small": [160, 160], "medium": [640, 640]} Thumbnails of protected images: name -> [width, height] (a bounding box).
KARNI_STORAGE_THUMBNAIL_FORMAT KARNI_STORAGE_THUMBNAIL_FORMAT "WEBP" The format thumbnails are written in (Pillow's name).
KARNI_STORAGE_THROTTLE_RATES KARNI_STORAGE_THROTTLE_RATES {"download": "1000/hour", "upload": "120/hour", "confirm": "120/hour"} The rate limits of the three endpoints, per caller: download, upload and confirm (scopes storage.download, ...). A rate under the scope in REST_FRAMEWORK["DEFAULT_THROTTLE_RATES"] wins. None turns a limit off.
KARNI_STORAGE_ALIAS KARNI_STORAGE_ALIAS "protected" The STORAGES alias that, when the project defines it, replaces the module's storage (an escape hatch: any backend).
R2_ACCOUNT_ID R2_ACCOUNT_ID "" Cloudflare R2's account id: the r2 preset's endpoint is built from it.