Settings¶
Every key of settings.NINJA_DEVX. Class attributes on your controllers override
them; unknown keys raise ImproperlyConfigured. See the Settings guide.
NINJA_DEVX¶
| Name | Type | Default | Description |
|---|---|---|---|
DEFAULT_OPTIONS |
ControllerOptions |
{} |
Options applied below every controller's own options. |
DOCUMENT_ERRORS |
bool |
True |
Add 401/403/404/422 responses to OpenAPI (default True). |
VALIDATE_MODEL |
bool |
True |
Run Model.full_clean() on CRUD writes; errors are 422. |
REFRESH_AFTER_WRITE |
bool |
True |
Reload objects through scoped_queryset() after writes. |
OPTIMIZE_QUERIES |
bool \| Literal['only'] |
True |
Derive select_related/prefetch_related from output schemas (default True). |
PAGINATION_CLASS |
type[PaginationBase] \| str \| None |
None |
Default pagination class for CRUD lists (a class or import path). |
BULK_LIMIT |
int |
100 |
Maximum objects per bulk request. |
IDEMPOTENCY_TTL |
int |
60 * 60 * 24 |
Seconds a stored idempotent() response is replayed. |
IDEMPOTENCY_DATABASE |
str |
'default' |
Database alias for durable idempotency records; must use autocommit. |
ERRORS |
ErrorMap \| str |
None |
Project error rules (an ErrorMap or its import path) added to the defaults. |
ERROR_FORMAT |
Literal['ninja', 'problem+json'] |
'ninja' |
Error body format: "ninja" ({detail, code}) or "problem+json" (RFC 9457). |
ASYNC_MODE |
Literal['sync', 'async'] |
'sync' |
What mode = "auto" model controllers use (default "sync"). |
WARN_BLOCKING_MS |
float \| None |
None |
Warn when sync code blocks an async operation's event loop longer than this. |
ASYNC_FETCH_MODE |
Literal['lazy', 'raise'] |
'lazy' |
"raise" makes lazy relation loads fail loudly in async operations (Django 6.1+). |
PLUGINS |
Sequence[ControllerPlugin \| str] |
() |
ControllerPlugin objects (or import paths) applied to every controller. |
TENANT_RESOLVER |
Callable[[HttpRequest], object] \| str |
None |
A function of the request returning the tenant (sync or async), or its import path. |
TENANT_CONTEXT |
object |
None |
A RequestContext[User, Tenant] key (or its import path) whose tenant is used. |
THROTTLE_RATES |
Mapping[str, str \| None] |
{} |
Rates for ScopedRateThrottle scopes, e.g. {"uploads": "10/min"}. |
THROTTLE_STORAGE |
object |
None |
A ThrottleStorage (or its import path) used by throttles without their own storage=; default: cache-based fixed windows. |
OBJECT_PERMISSION_BACKEND |
object |
None |
An ObjectPermissionBackend (or its import path); default: grants, guardian, Django. |
CHECK_APIS |
Sequence[str] |
() |
NinjaAPI import paths validated by manage.py check. |
WEBHOOK_SECRET_KEYS |
Sequence[str] |
() |
Fernet keys encrypting webhook signing secrets at rest (ninja-devx[crypto]); the first encrypts, all decrypt. Empty: secrets are stored as they are. |