Settings and checks
Django settings
| Setting | Default | Purpose |
|---|---|---|
CHASSIS_USERS_MODULE_ENABLED | True | Globally enable the built-in users runtime |
CHASSIS_PERMISSION_CHECK | 'group_only' | group_only or user_has_perm |
CHASSIS_PERMISSION_NAME_NORMALIZATION_ENABLED | False | Normalize stock Django permission display names after migrate |
CHASSIS_PERMISSION_NAME_NORMALIZATION_LANGUAGE | required when enabled | Currently 'ru' |
CHASSIS_WORKER_PROVIDER | 'auto' | Select a provider by name, 'auto', or 'none' Added in 1.0.19 |
CHASSIS_WORKER_PROVIDERS | Dramatiq, Celery | Ordered provider class paths Added in 1.0.19 |
CELERY_BROKER_URL | none | Celery provider detects the project integration |
DRAMATIQ_BROKER | none | Dramatiq provider detects the project integration Added in 1.0.19 |
STORAGES['media'] | project storage | Import/export file storage |
CHASSIS_LOGIN_ATTEMPT_LIMITS_ENABLED | True | Apply login-attempt schedule delays |
CHASSIS_ADMIN_PATH_PREFIX | '/admin/' | Prefix watched by session and audit middleware |
CHASSIS_LIST_PAGE_SIZES | (25, 50, 75, 100) | List or tuple of distinct positive page sizes Changed in 1.0.23 |
CHASSIS_LIST_PAGE_SIZE | first available size | Starting page size Added in 1.0.23 |
GEOIP_COUNTRY_DATABASE_PATH | unset | GeoLite2 Country MMDB for session/profile country |
CHASSIS_FOOTER | {} | Developer, product and version details Added in 1.0.23 |
CHASSIS_OBSERVATION_PERIOD_HOURS | 24 | Observability lookback in hours, from 1 to 720 Added in 1.0.23 |
Optional middleware for Chassis HTML error pages, admin sessions, and the Admin journal:
MIDDLEWARE = [
# ...
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django_chassis.middlewares.UserSessionMiddleware',
'django_chassis.middlewares.AdminAuditMiddleware',
'django_chassis.middlewares.AdminErrorPageMiddleware',
]
See Users and access for GeoIP and login-attempt settings.
Added in 1.0.7Set CHASSIS_USERS_MODULE_ENABLED = False when the application keeps its own
user profiles, Admin sessions, login protection, and audit journal. This is a
global opt-out; the per-site include_users_module flag cannot override it.
Admin error-page fallback
Changed in 1.0.3When the full AdminSite.each_context() is unavailable, the safe HTML
error-page fallback independently calls get_chassis_footer_context() and
preserves its developer, product, and version details. An AdminSite without
that hook, or an exception raised by the hook, produces an empty footer context
without preventing the error page from rendering.
There is no large Chassis settings block. Site and ModelAdmin behaviour is declared in Python on the mixins.
System checks
ChassisAdminMixin and ChassisAdminSiteMixin register Django system checks for:
- action permission references
- export field / filter lookups
- sidebar model and page references
- dashboard layout (duplicate slugs, chart cardinality, global alerts)
Run them with the rest of Django's checks:
uv run python manage.py check
Construction-time errors (ImproperlyConfigured) fire when the AdminSite
is instantiated: invalid page access contracts, missing view_* permissions
on PermissionAdminPage, personal pages in navbar groups.
Trusted proxies
Added in 1.0.23Set CHASSIS_TRUSTED_PROXY_NETWORKS to a list or tuple of IP network strings
for trusted reverse proxies. The default empty list uses REMOTE_ADDR. Chassis
follows X-Forwarded-For from right to left while the current hop is trusted.
The first untrusted hop is the client address. If every hop is trusted, Chassis
uses the leftmost address. A malformed address encountered along this walk
causes a fallback to REMOTE_ADDR.
Supported runtime
Changed in 1.0.23- Python 3.13 and 3.14 with Django 6.0 or newer
- Python 3.15 with Django 6.1.3 or newer
Pull requests run security scans and dependency audits. Pushes to main run tests and builds. CI tests each Python version with the minimum supported Django and the Django version in uv.lock. Publishing the Python package and deploying this site both require the shared tests and security checks.
Gunicorn
Added in 1.0.1 Changed in 1.0.20Chassis ships manage.py run_gunicorn. It starts the project WSGI app with
sync workers:
pip install 'django-chassis[gunicorn]'
uv run python manage.py run_gunicorn --port=8000 --workers=2
Gunicorn is an optional extra for WSGI projects. ASGI deployments can use run_uvicorn with the [uvicorn] extra. Importing the command does not load Gunicorn.
The WSGI target comes from --app or Django WSGI_APPLICATION
(project.wsgi.application becomes project.wsgi:application). Optional
--config points at a Gunicorn Python config.
Uvicorn
Added in 1.0.20pip install 'django-chassis[uvicorn]'
uv run python manage.py run_uvicorn --host 0.0.0.0 --port 8000 --workers 2
uv run python manage.py run_uvicorn --workers 1 --reload
The command resolves --app or Django ASGI_APPLICATION. Both
project.asgi.application and project.asgi:application are accepted. Command
discovery and --help work without Uvicorn installed; execution explains the
required extra. Unrelated missing imports keep their original error.
| Option | Default | Environment override |
|---|---|---|
--host | 0.0.0.0 | — |
--port, -p | 8000 | PORT |
--workers, -w | 2 | UVICORN_WORKERS |
--log-level, -l | info | — |
--timeout | 30 seconds, graceful shutdown | — |
--timeout-keep-alive | 5 seconds | — |
--ws-max-size | 16777216 bytes | UVICORN_WS_MAX_SIZE |
--ws-max-queue | 32 frames | UVICORN_WS_MAX_QUEUE |
--reload requires one worker. Ports must be 1–65535; workers, timeouts and
WebSocket limits must be positive. Explicit CLI arguments override environment
variables. Invalid unused environment defaults do not break --help.
CHASSIS_UVICORN_WS_MAX_SIZE and CHASSIS_UVICORN_WS_MAX_QUEUE optionally set the
project's WebSocket transport defaults. CLI arguments and environment variables
take precedence over these settings; otherwise the standard defaults above apply.
These limits bound Uvicorn's transport. Application protocol/authorization limits
remain the project's responsibility. See Uvicorn settings.
Optional extra
pip install 'django-chassis[celery]'
pip install 'django-chassis[dramatiq]'
Worker selection applies to tasks in the shared Chassis worker registry. The
optional risk observation schedule uses Celery.
See Background tasks
for registration and additional providers, and Import/export backends
for the single WORKER form choice.
See also
Optional GlobalConfig integration
Added in 1.0.23Install the global-config extra to add a typed settings catalog with modal
editing. Follow the GlobalConfig setup and editing guide.
Redacting log messages
Added in 1.0.23Set the filter factory to django_chassis.logging.SensitiveDataFilter in LOGGING
and add the filter to each handler that needs it. It masks sensitive values
in rendered key-value messages, including values passed as logging arguments.
The filter can be imported before the Django apps are loaded.
LOGGING = {
'version': 1,
'disable_existing_loggers': False,
'filters': {
'redact': {'()': 'django_chassis.logging.SensitiveDataFilter'}
},
'handlers': {
'console': {'class': 'logging.StreamHandler', 'filters': ['redact']}
},
'root': {'handlers': ['console'], 'level': 'INFO'}
}
To enable additional field names with Django-GC 1.1.5 or newer, add the
provider below to GLOBAL_CONFIG_PROVIDERS and set 'use_global_config': True
in the filter configuration. Run manage.py initialize_global_configs.
from django_gc import ProviderDefinition
GLOBAL_CONFIG_PROVIDERS = [
ProviderDefinition(
provider='django_chassis.logging.configuration_provider.LoggingConfigurationProvider',
category_ids={'redaction': 31}
)
]
logging.sensitive_keys accepts a JSON list of field names, such as
["customer_reference"]. Configured names match the entire key regardless of
case, hyphens and underscores. The built-in suffixes password, passphrase,
token, secret, authorization and apikey always apply. The filter handles
rendered text and nested mappings, lists and tuples in LogRecord.msg and
LogRecord.args. Apply separate controls to extra fields and exception traces.
Each process starts a background read on an eligible log after Django is ready and may refresh every 30 seconds while logging. The last successful list stays active during refresh failures. Before the first successful read, the default names apply. The formatter and level are configured at process startup.
Redacting structured audit data
Added in 1.0.24Use django_chassis.logging.SensitiveDataRedactor to mask structured data before publishing an audit
event. redact(value) returns a sanitized copy of mappings, lists and tuples and masks sensitive values
in text. additional_keys adds exact names with the same case, hyphen and underscore normalization as
the logging filter. Pass the field names used by the API, including OTP, CAPTCHA responses, cookies and
recovery links. Read any configured extensions and include them in additional_keys before sending
events.
from django_chassis.logging import SensitiveDataRedactor
redactor = SensitiveDataRedactor(
additional_keys={'otp_code', 'cf-turnstile-response', 'cookie', 'set-cookie', 'recovery_url'}
)
safe_payload = redactor.redact(payload)
Build the payload from allowed fields. For routes with secrets in the path, record the route template. The Chassis Admin audit applies the shared key check alongside its administrative query keys and omits matching query parameters. Each retained query parameter keeps its original list of values.
Frontend for impersonation
Added in 1.0.23The Chassis provider setup registers
chassis.impersonation_frontend_url and explains how to adopt the provider
when the project already defines the key.