Configuration
All djxi settings are optional and have sensible defaults. Override them in
your project’s settings.py.
Runtime settings
These values can be set in settings.py and are read by the
djxi.conf.Settings proxy (importable as djxi.conf.package_settings):
Setting |
Default |
Description |
|---|---|---|
|
|
HTMX version to use for the CDN script tag. Accepted values: |
|
|
Script variant to load from CDN. Use |
|
|
Global URL prefix prepended to every battery route when
|
|
|
DOM element ID used as the |
|
|
HTMX swap method applied when injecting messages into the container. |
|
|
Template path for the message list fragment. Override to customise message rendering without touching the container. |
|
|
Module suffixes that the |
Immutable constants
The following values are defined in djxi.const and cannot be
overridden via settings.py — the Settings proxy returns them before
checking django.conf.settings:
Constant |
Value |
Purpose |
|---|---|---|
|
|
HTML tag name used to delimit named template sections. |
|
|
HTML tag name used to inline-expand another section. |
URL prefix resolution order
When url_patterns() is called, the prefix is resolved in the following
priority order (highest wins):
Explicit kwarg:
MyBattery.url_patterns(prefix="my/prefix")Class attribute:
battery_prefix = "my-prefix"on the battery classDjango setting:
DX_ROUTER_PREFIX(default"dx")
Example:
class ApiV1Battery(DXEndpointBattery):
battery_prefix = "api/v1"
@dx_get("items/", name="items")
def items(self, request):
...
# In urls.py — no prefix= needed, battery_prefix is used:
urlpatterns = [
path("", include(ApiV1Battery.url_patterns())),
# Registers: GET /api/v1/items/
]
Startup validation
DjxiAppConfig.ready() validates DX_HTMX_VERSION, DX_HTMX_COMPRESSION,
and DX_ROUTER_PREFIX on startup and raises ImproperlyConfigured with a
descriptive message if any value is invalid.