Asok is designed to require minimal configuration for common use-cases, but it provides a comprehensive set of options that can be tuned via environment variables or directly in your wsgi.py / asgi.py file.
Asok supports SQLite (default, zero dependencies), PostgreSQL, and MySQL, alongside built-in point-in-time recovery database backups.
Key
Type
Default
Description
DATABASE_URL
str
"sqlite:///db.sqlite3"
Connection DSN. Can be SQLite (sqlite:///db.sqlite3), PostgreSQL (postgresql://user:pass@host:5432/dbname), or MySQL (mysql://user:pass@host:3306/dbname).
DATABASE_BACKUP_ENABLED
bool
True
Enables or disables automated database backup operations and background backup scheduling.
DATABASE_BACKUP_URL
str
None
Optional custom backup target database DSN (defaults to primary DATABASE_URL).
DATABASE_BACKUP_PATH
str
None
Custom directory path for saving backup snapshot files (defaults to .asok/backups or relative to DB file).
DATABASE_BACKUP_MAX_SNAPSHOTS
int
10
Maximum number of historic point-in-time recovery backup snapshots to keep before automatic rotation.
The URL path where the auto-generated docs are served.
OPENAPI_PATH
str
"/openapi.json"
The URL path for the generated OpenAPI specification.
OPENAPI_AUTHORIZE
callable
None
Hook (request) -> bool that guards access to the /openapi.json spec endpoint only. If not set, the spec is public.
API_TITLE
str
PROJECT_NAME
The title shown in the documentation UI.
API_LOGO
str
SITE_LOGO
URL of the logo shown in the documentation UI.
SITE_LOGO
str
None
URL of the default site-wide logo (fallback for API_LOGO).
GRAPHQL_ENABLED
bool
False
Show "GraphQL Explorer" link in the /docs sidebar.
GRAPHQL_PATH
str
"/graphql"
Path used for the docs sidebar link. Does not change the actual endpoint.
GRAPHQL_AUTHORIZE
callable
None
Hook (request) -> bool that guards all GraphQL requests. Mutations are blocked by default if this is not set and GRAPHQL_ALLOW_UNAUTHENTICATED_MUTATIONS is not True.
GRAPHQL_ALLOW_UNAUTHENTICATED_MUTATIONS
bool
False
Set to True to allow mutations without an auth hook. Not recommended for public endpoints.
GRAPHQL_MAX_COMPLEXITY
int
100
Statically checks query complexity to prevent abuse.
When running Asok in production (DEBUG=False), certain configurations are strictly enforced to ensure the security of your application. The framework will raise a RuntimeError on startup if these are missing or insecure.
You can set configurations directly on the app instance using the config dictionary.
fromasokimportAsokapp=Asok()# Production overridesapp.config["DEBUG"]=Falseapp.config["SECRET_KEY"]="your-ultra-secure-64-character-key-here"app.config["APP_URL"]="https://myapp.com"
In production, DEBUG defaults to False. You only need to set it to True explicitly in your development environment.