All settings
Every setting Ushka reads, generated from the schema in ushka.core.settings: if a key is not here, Ushka does not use it.
Set any of them in ushka.toml, or as USHKA_<SECTION>_<KEY> in .env or the environment
(USHKA_SECURITY_CSRF=false). Lists are ["a", "b"] in TOML and a,b in the environment.
Each section lists its Common settings first, then the Advanced ones you will rarely touch.
See Configuration for how the layers work.
ushka config --all prints the same keys with the value in use, ushka config --template an annotated ushka.toml.
[app]
Your application.
| Key | Default | Meaning |
|---|---|---|
name |
"Ushka App" |
Display name. Used in page titles, the SEO site name and the PWA name. |
debug |
false |
Debug pages with tracebacks and local variables. Never turn it on in production. |
strict_templates |
false |
A variable missing from a template raises an error instead of rendering empty. Always on when debug is on. |
auto_discover |
true |
Load route files from the routes/ folder. |
secret_key |
(set it in the environment) | Signs the session cookie. Use USHKA_APP_SECRET_KEY in .env, never this file. |
[database]
The database used by the async ORM. See orm.
| Key | Default | Meaning |
|---|---|---|
url |
"sqlite:///ushka.db" |
SQLAlchemy URL. Plain sqlite://, postgresql:// and mysql:// get an async driver. DATABASE_URL also works. |
[server]
How ushka dev, ushka run and app.run() serve the app. See deploy.
| Key | Default | Meaning |
|---|---|---|
host |
"127.0.0.1" |
Address to bind. Use "0.0.0.0" in a container. |
port |
8000 |
Port to listen on. |
workers |
1 |
Worker processes for ushka run (ushka dev always uses one). |
[routes]
Which routes answer on which host name. See routing.
| Key | Default | Meaning |
|---|---|---|
hosts |
{} |
Routes per host: { "dashboard.example.com" = "routes_dashboard", "api.*" = "routes_api" }. A host (or glob) maps to a folder of route files, or a list of folders. A request for that host is answered by those routes alone; every other host by routes/. Environment: host=folder,host=folder. |
[static]
Serving static files. See static files.
Common
| Key | Default | Meaning |
|---|---|---|
enable |
false |
Serve the static folder under url. |
url |
"/static" |
URL prefix of the static files. |
dir |
"static" |
Folder with the files, relative to the app directory or absolute. |
Advanced
| Key | Default | Meaning |
|---|---|---|
cache_control |
"public, max-age=3600" |
Cache-Control sent with every static file. |
[session]
Sessions: a signed cookie by default, or revocable sessions kept on the server. See sessions.
Common
| Key | Default | Meaning |
|---|---|---|
store |
"cookie" |
Where sessions live: "cookie" (signed, in the browser) or "database" (revocable, no size limit; needs [database] url, else cookies are used). |
max_age |
1209600 |
Seconds a session lasts, counted from its creation (14 days). 0 means no limit. |
idle_timeout |
0 |
Server-side stores only: seconds without a request after which a session ends. 0 turns it off. |
encrypt |
false |
Cookie sessions only: encrypt the cookie (Fernet) instead of only signing it, so the browser cannot read it. Needs ushka[crypto]. Logs everyone out once, when turned on or off. |
Advanced
| Key | Default | Meaning |
|---|---|---|
cookie_name |
"_ushka_session" |
Name of the session cookie. |
user_key |
"user_id" |
Server-side stores only: the session key that holds the user id, used to revoke all of a user's sessions. |
table |
"ushka_sessions" |
Table used by store = "database". Created on first use. |
[crypto]
Encryption (Fernet): the keys behind ushka.crypto, encrypted sessions and db.Encrypted (needs ushka[crypto]). See crypto.
Common
| Key | Default | Meaning |
|---|---|---|
keys |
(set it in the environment) | Fernet keys, newest first: the first encrypts, all decrypt (key rotation). Make one with ushka crypto genkey. Use USHKA_CRYPTO_KEYS (comma separated), never this file. Empty derives a key from [app] secret_key. |
Advanced
| Key | Default | Meaning |
|---|---|---|
keep_derived |
false |
Also accept the key derived from [app] secret_key when decrypting, after the first key. Turn it on when you move from the derived key to a dedicated one in keys, so old data stays readable. |
[limits]
Size limits that protect the server from huge requests.
| Key | Default | Meaning |
|---|---|---|
max_request_body_size_in_KB |
2048 |
Largest request body, in KB. Bigger bodies get 413. |
max_request_body_multipart_size_in_KB |
51200 |
Largest multipart upload, in KB. |
websocket_max_message_in_KB |
1024 |
Largest WebSocket message, in KB. Bigger ones close the socket with 1009. |
[security]
Ushka Guard and the security middleware, all on by default. See security.
Common
| Key | Default | Meaning |
|---|---|---|
headers |
true |
Security headers on every response (nosniff, frame options, referrer policy, CSP, HSTS). |
csp |
"" |
Content-Security-Policy. Empty is the strict default policy; "off" sends none. |
csrf |
true |
CSRF protection for writes from browsers, without tokens. |
csrf_trusted_origins |
[] |
Other origins allowed to send writes. |
csrf_exempt_paths |
[] |
Paths that skip the CSRF check (webhooks, for example). |
allowed_hosts |
[] |
Accepted Host headers. Empty means any host: set it in production. |
trusted_proxies |
[] |
IPs and CIDRs of your reverse proxies (Caddy, nginx). Only these may set X-Forwarded-For, -Proto and -Host. Empty trusts no one. |
cors_origins |
[] |
Origins allowed by CORS. Empty means no CORS headers. |
Advanced
| Key | Default | Meaning |
|---|---|---|
taint |
true |
Ushka Guard: request data arrives as Untrusted and dangerous sinks refuse it. Turning it off is a migration aid, not a mode. |
frame_options |
"DENY" |
X-Frame-Options. |
referrer_policy |
"strict-origin-when-cross-origin" |
Referrer-Policy. |
hsts_seconds |
31536000 |
Strict-Transport-Security max-age, sent on https requests only. 0 turns it off. |
cors_methods |
["GET", "POST", "PUT", "PATCH", "DELETE"] |
Methods CORS allows. |
cors_headers |
[] |
Request headers CORS allows. Empty echoes what the preflight asks for. |
cors_credentials |
false |
Let other origins send cookies. Refused together with "*". |
cors_max_age |
600 |
Seconds a browser may cache the preflight answer. |
[oauth]
Sign in with Google or GitHub (OAuth 2.0 / OpenID Connect). A provider is on when it has a client id and a client secret. See auth.
Common
| Key | Default | Meaning |
|---|---|---|
google_client_id |
"" |
Client ID of your Google OAuth credentials. Empty turns the Google login off. |
google_client_secret |
(set it in the environment) | Client secret of the Google credentials. Use USHKA_OAUTH_GOOGLE_CLIENT_SECRET, never this file. |
github_client_id |
"" |
Client ID of your GitHub OAuth app. Empty turns the GitHub login off. |
github_client_secret |
(set it in the environment) | Client secret of the GitHub OAuth app. Use USHKA_OAUTH_GITHUB_CLIENT_SECRET, never this file. |
redirect_base |
"" |
Public origin used to build the redirect URI, such as "https://example.com". Empty uses [seo] url. The Host header is never trusted (debug mode may use it). |
allowed_email_domains |
[] |
Only e-mail addresses at these domains may sign in, such as ["example.com"]. Empty allows any verified address. |
login_prefix |
"/auth" |
URL prefix of the login routes: <prefix>/<provider>/login and <prefix>/<provider>/callback. |
Advanced
| Key | Default | Meaning |
|---|---|---|
session_key |
"user" |
Session key that holds the logged-in user's profile (provider, sub, email, name, picture). |
after_login |
"/" |
Where a visitor lands after signing in when no valid next page was asked for. |
login_error_path |
"/" |
Where a failed login sends the visitor, with ?login_error=<code> (denied, state, network, token, profile, unverified, domain, provider, config). |
callback_path |
"" |
Path of the callback, when the provider console already lists another one, such as "/oauth/{provider}/callback". {provider} is the provider name. Empty uses <login_prefix>/<provider>/callback. |
[i18n]
Translations from gettext catalogs: _(), {% trans %} and the language of each request (off by default). See i18n.
Common
| Key | Default | Meaning |
|---|---|---|
enable |
false |
Pick a language for every request and translate with _(), {% trans %} and gettext. |
default_locale |
"en" |
Language of the source texts and the one used when nothing else matches. |
locales |
[] |
Languages the app accepts, such as ["en", "pt-BR"]. Anything else a client asks for is ignored. The default is always included. |
catalog_dir |
"locale" |
Folder with the catalogs, relative to the app directory: |
order |
["query", "cookie", "header"] |
Where the language comes from, first match wins: query (?lang=), cookie and header (Accept-Language). |
Advanced
| Key | Default | Meaning |
|---|---|---|
domain |
"messages" |
Name of the catalog file (messages.mo). Django catalogs are django.mo. |
query_param |
"lang" |
Query parameter that picks the language. |
cookie |
"lang" |
Cookie that remembers the language. |
remember |
true |
Store a language chosen with the query parameter in the cookie. |
[seo]
SEO tags, robots.txt and sitemap.xml, ready out of the box. See seo.
Common
| Key | Default | Meaning |
|---|---|---|
enable |
true |
{{ seo() }} tags, /robots.txt and /sitemap.xml. false turns all of it off. |
url |
"" |
Public origin, such as "https://example.com". Needed for canonical links and the sitemap. |
site_name |
"" |
Site name in titles and social cards. Empty uses [app] name. |
title |
"" |
Title of pages that set none (usually the home page). |
description |
"" |
Default meta and social description. |
image |
"" |
Default social preview image, a path or a URL. |
robots |
"index, follow" |
Robots rule. "noindex, nofollow" keeps a staging site out of search. |
robots_disallow |
[] |
Paths written as Disallow lines in robots.txt. |
Advanced
| Key | Default | Meaning |
|---|---|---|
title_template |
"{title} · {site_name}" |
How a page title is combined with the site name. |
image_alt |
"" |
Alternative text of that image. |
locale |
"en_US" |
Open Graph locale. |
type |
"website" |
Default Open Graph type. |
author |
"" |
Default author. |
twitter_site |
"" |
Twitter/X handle of the site, such as "@example". |
twitter_card |
"summary_large_image" |
Twitter/X card type when there is an image. |
jsonld |
true |
Structured data: WebSite on the home page, Article for articles. |
robots_txt |
true |
Serve /robots.txt. |
sitemap |
true |
Serve /sitemap.xml. |
sitemap_paths |
[] |
Extra paths to list in the sitemap (pages with parameters). |
sitemap_exclude |
["/api/*", "/admin/*", "/_*"] |
Patterns left out of the sitemap. Plain GET pages are listed otherwise. |
[pwa]
Progressive Web App: manifest, service worker and offline page (off by default). See pwa.
Common
| Key | Default | Meaning |
|---|---|---|
enable |
false |
Serve the manifest, service worker and offline page. |
name |
"" |
App name. Empty uses [seo] site_name, then [app] name. |
short_name |
"" |
Short name under the home-screen icon (12 characters work best). |
description |
"" |
Empty uses [seo] description. |
display |
"standalone" |
standalone, fullscreen, minimal-ui or browser. |
theme_color |
"#1b1720" |
Colour of the title bar. |
background_color |
"#ffffff" |
Colour of the splash screen. |
icons |
[] |
Paths, or [[pwa.icons]] tables with src, sizes, type and purpose. Chrome wants 192x192 and 512x512 PNGs. |
Advanced
| Key | Default | Meaning |
|---|---|---|
start_url |
"/" |
Where the installed app opens. |
scope |
"/" |
Which URLs the installed app and the service worker control. |
orientation |
"" |
Optional lock, such as "portrait" or "landscape". |
lang |
"" |
Language of the manifest, such as pt-BR. |
id |
"" |
Stable identity of the app. Empty uses start_url. |
categories |
[] |
Store categories, such as ["productivity"]. |
shortcuts |
[] |
[[pwa.shortcuts]] tables with name and url, shown on long-press. |
offline |
true |
Show an offline page when a navigation fails for lack of network. |
offline_title |
"You are offline" |
Title of the built-in offline page. |
offline_message |
"Check your connection and try again." |
Text of the built-in offline page. |
precache |
[] |
Extra URLs fetched when the worker installs. They must all exist. |
cache_paths |
[] |
Extra URL prefixes cached at runtime. [static] is always included. |
cache_version |
"1" |
Change it to drop every cache on the next visit. |
manifest_path |
"/manifest.webmanifest" |
Where the manifest is served. |
sw_path |
"/sw.js" |
Where the service worker is served. |
script_path |
"/pwa.js" |
Where the script that registers the worker is served. |
offline_path |
"/offline" |
Where the offline page is served. |
[mcp]
The MCP endpoint that exposes routes as tools for AI agents. See agents.
| Key | Default | Meaning |
|---|---|---|
token |
(set it in the environment) | Bearer token of the MCP endpoint. Use USHKA_MCP_TOKEN, never this file. |
[imap]
Reading e-mail over IMAP (ushka.mail.ImapClient): the inbox of a support, leads or receipts address. Off until host is set. See mail.
Common
| Key | Default | Meaning |
|---|---|---|
host |
"" |
IMAP server, for example imap.example.com. Empty means the mail client is not configured. |
user |
"" |
Login name, usually the full address. |
password |
(set it in the environment) | Password or app password. Use USHKA_IMAP_PASSWORD, never this file. |
folder |
"INBOX" |
Folder selected when the client connects. |
max_parts |
100 |
Most MIME parts (body, alternatives, attachments) accepted in one message. |
Advanced
| Key | Default | Meaning |
|---|---|---|
port |
993 |
Server port: 993 for TLS from the start, usually 143 with starttls. |
ssl |
true |
TLS from the first byte, with the certificate and host name verified. Turning it off needs starttls or allow_insecure. |
starttls |
false |
With ssl = false, upgrade a plain connection to verified TLS before logging in. |
allow_insecure |
false |
Allow a plain-text connection (ssl = false, starttls = false). The password travels in the clear: only for a local test server. |
timeout |
30 |
Seconds to connect, and to wait for the server on each read. |
max_message_kb |
10240 |
Largest message in KB. A bigger one is refused from its size, before its body is downloaded. |