Config reference
All 33config class attributes and DJUST_CONFIG settings keys.
Two ways to configure djust: per-view class attributes (set on a LiveView subclass) control that view's behaviour, while DJUST_CONFIG keys in settings.py set project-wide defaults for security, serialization, transport, and developer tooling.
LiveView attributes
Per-view behaviour set on the classAttributes you set directly on a LiveView subclass to control that view: which template it renders, authentication and permissions, memory behavior (temporary_assigns, static_assigns), stickiness across navigation, and opt-in features like state snapshots and streaming render.
template_name
Path to the Django template for this view (relative to the template dirs). str
Type
str
Default
None
Path to the Django template for this view (relative to the template dirs). Either template_name or template is required.
class ProfileView(LiveView):
template_name = 'profile.html'
template
An inline template string, rendered directly without a file lookup. str
Type
str
Default
None
An inline template string, rendered directly without a file lookup. Handy for tiny views or tests; use template_name otherwise.
class SimpleView(LiveView):
template = '<div dj-root>{{ count }}</div>'
tick_interval
When set (milliseconds), handle_tick() is called periodically on the server — useful for clocks or status polling. int
Type
int
Default
None
When set (milliseconds), handle_tick() is called periodically on the server — useful for clocks or status polling. None disables ticking.
class ClockView(LiveView):
tick_interval = 1000
def handle_tick(self):
self.now = timezone.now()
temporary_assigns
Maps assign name -> default value; the assign is reset after each render. dict
Type
dict
Default
{}
Maps assign name -> default value; the assign is reset after each render. A memory optimisation for large collections (chat messages, feeds) you don't want held in server state.
class ChatView(LiveView):
temporary_assigns = {'messages': []}
static_assigns
Names of assigns sent to the client only on the first render; the Rust engine retains them across patches. list[str]
Type
list[str]
Default
[]
Names of assigns sent to the client only on the first render; the Rust engine retains them across patches. Use for large, unchanging context to keep the state channel small.
class DocsView(LiveView):
static_assigns = ['catalog']
login_required
When True, unauthenticated users are redirected to login_url before mount(). bool
Type
bool
Default
None
When True, unauthenticated users are redirected to login_url before mount(). Use permission_required for role checks.
class Dashboard(LiveView):
login_required = True
login_url = '/login/'
permission_required
Django permission string(s) checked after authentication; a single string or a list. str | list[str]
Type
str | list[str]
Default
None
Django permission string(s) checked after authentication; a single string or a list. Raises PermissionDenied if not met.
class AdminView(LiveView):
permission_required = ['app.view_data', 'app.change_data']
login_url
Where to send unauthenticated users when login_required=True. str
Type
str
Default
None
Where to send unauthenticated users when login_required=True. Overrides settings.LOGIN_URL.
class PrivateView(LiveView):
login_required = True
login_url = '/accounts/login/'
on_mount
Hook functions run before mount() on every mount/reconnect, in MRO order. list[Callable]
Type
list[Callable]
Default
[]
Hook functions run before mount() on every mount/reconnect, in MRO order. Each returns None to continue or a URL to redirect. See the @on_mount decorator.
class ProfileView(LiveView):
on_mount = [require_verified_email]
api_name
Stable slug for HTTP API exposure: handlers marked @event_handler(expose_api=True) are served at /djust/api/<api_name>/. str
Type
str
Default
None
Stable slug for HTTP API exposure: handlers marked @event_handler(expose_api=True) are served at /djust/api/<api_name>/. If None, derived from the module path (not stable across renames).
class ExportView(LiveView):
api_name = 'data_export'
api_auth_classes
Auth classes tried in order for the HTTP API; the first returning a user wins. list
Type
list
Default
None
Auth classes tried in order for the HTTP API; the first returning a user wins. Defaults to [SessionAuth] when None. CSRF is enforced unless the winning class is csrf_exempt.
class APIView(LiveView):
api_name = 'endpoint'
api_auth_classes = [TokenAuth(), SessionAuth()]
sticky
Preserve this view's instance and DOM across live_redirect navigation. bool
Type
bool
Default
False
When True and embedded via {% live_render sticky=True %}, the instance, DOM, form values, scroll/focus and background tasks survive live_redirect navigation — provided the destination layout has a matching dj-sticky-slot.
class SidebarView(LiveView):
sticky = True
sticky_id = 'main_sidebar'
sticky_id
Required when sticky=True. str
Type
str
Default
None
Required when sticky=True. Must match the dj-sticky-slot name in the destination template to preserve state across navigation.
class ChatSidebar(LiveView):
sticky = True
sticky_id = 'chat_sidebar'
use_actors
Routes event handlers through the Tokio actor system instead of the thread pool (Phase 5+, experimental). bool
Type
bool
Default
False
Routes event handlers through the Tokio actor system instead of the thread pool (Phase 5+, experimental). Set True only for features that need actor isolation.
class CounterView(LiveView):
use_actors = True
enable_state_snapshot
Opt in to back-navigation state restoration via the Service Worker. bool
Type
bool
Default
False
Opt in to Service-Worker state restoration on back-navigation: the client posts a JSON state snapshot on popstate and the server restores public attributes before mount(). Override _should_restore_snapshot() to reject stale snapshots.
class FilteredList(LiveView):
enable_state_snapshot = True
streaming_render
Return a chunked StreamingHttpResponse from HTTP GET for faster first paint. bool
Type
bool
Default
False
When True, an HTTP GET returns a StreamingHttpResponse flushed in chunks (shell-open, content, shell-close) so the browser can load CSS/JS while the server computes content. Requires ASGI.
class LargeDetail(LiveView):
streaming_render = True
time_travel_enabled
Dev-only: records a per-instance ring buffer of event snapshots so the debug panel's Time Travel tab can scrub history. bool
Type
bool
Default
False
Dev-only: records a per-instance ring buffer of event snapshots so the debug panel's Time Travel tab can scrub history. Gated on DEBUG=True; no-ops in production.
class DebugView(LiveView):
time_travel_enabled = True
abstract
Marks an abstract base LiveView so system checks (e.g. bool
Type
bool
Default
False
Marks an abstract base LiveView so system checks (e.g. requiring template_name) skip it. Not inherited — subclasses must redeclare it. Mirrors Django's Meta.abstract.
class BaseFormView(LiveView):
abstract = True
allowed_model_fields
Restricts which attributes dj-model may bind. list[str]
Type
list[str]
Default
None
Restricts which attributes dj-model may bind. None allows all non-forbidden fields; a list restricts to exactly those. Forbidden fields (template_name, request…) are always blocked.
class FormView(LiveView):
allowed_model_fields = ['name', 'email', 'message']
DJUST_CONFIG settings
Project-wide defaults in settings.pyProject-wide defaults set in settings.py under DJUST_CONFIG: the CSS framework, event-handler security mode, WebSocket message limits and rate limiting, serialization behavior, and developer tooling such as hot reload and time-travel debugging. These apply to every view unless a class attribute overrides them.
css_framework
Which CSS framework the form helpers and components target: 'bootstrap5', 'bootstrap4', 'tailwind', or None. str
Type
str
Default
'bootstrap5'
Which CSS framework the form helpers and components target: 'bootstrap5', 'bootstrap4', 'tailwind', or None. Drives the default field/error/button classes.
DJUST_CONFIG = {
'css_framework': 'tailwind',
}
event_security
How strictly event handlers must be marked (open / warn / strict). str
Type
str
Default
'strict'
How strictly event handlers must be marked: 'open' (no checks), 'warn' (allow unmarked, log), 'strict' (only @event_handler methods are callable). Use 'strict' in production.
DJUST_CONFIG = {
'event_security': 'strict',
}
max_message_size
Maximum size in bytes for an incoming WebSocket message (0 = unlimited). int
Type
int
Default
65536
Maximum size in bytes for an incoming WebSocket message (0 = unlimited). Default 64KB; protects against memory exhaustion from oversized payloads.
DJUST_CONFIG = {
'max_message_size': 131072, # 128KB
}
rate_limit
Global WebSocket rate limiting. dict
Type
dict
Default
{'rate': 100, 'burst': 20, 'max_warnings': 3, 'max_connections_per_ip': 10, 'reconnect_cooldown': 5}
Global WebSocket rate limiting. Keys include rate (events/sec), burst (bucket size), max_connections_per_ip and reconnect_cooldown. Mitigates floods and abusive reconnects.
DJUST_CONFIG = {
'rate_limit': {'rate': 50, 'burst': 10},
}
serialization_max_depth
Maximum depth for nested model serialization (e.g. int
Type
int
Default
3
Maximum depth for nested model serialization (e.g. lease.tenant.user is 3 levels). Prevents runaway recursion and bloat on circular relations.
DJUST_CONFIG = {
'serialization_max_depth': 2,
}
strict_serialization
When False, non-serializable values are coerced via str() with a warning. bool
Type
bool
Default
False
When False, non-serializable values are coerced via str() with a warning. When True, they raise TypeError with an actionable message — useful to catch state bugs in development.
DJUST_CONFIG = {
'strict_serialization': True,
}
jit_serialization
Enables JIT auto-serialization of Django models by the Rust engine at render time. bool
Type
bool
Default
True
Enables JIT auto-serialization of Django models by the Rust engine at render time. Disable only for testing or custom serialization.
DJUST_CONFIG = {
'jit_serialization': True,
}
jit_cache_backend
Where compiled JIT serializers are cached (filesystem or redis). str
Type
str
Default
'filesystem'
Where compiled JIT serializers are cached: 'filesystem' (default, fine for most) or 'redis' (for multi-worker deployments).
DJUST_CONFIG = {
'jit_cache_backend': 'redis',
}
hot_reload
Dev-only (requires DEBUG=True): watches template and Python files and reloads the view in the browser on change. bool
Type
bool
Default
True
Dev-only (requires DEBUG=True): watches template and Python files and reloads the view in the browser on change. Auto-enabled at startup unless hot_reload_auto_enable is False.
DJUST_CONFIG = {
'hot_reload': True,
}
hvr_enabled
Hot View Replacement — state-preserving Python code reload in dev. bool
Type
bool
Default
True
Hot View Replacement — state-preserving Python code reload in dev. Gated on DEBUG=True and hot_reload=True; reloads handler code without reconnecting or losing state.
DJUST_CONFIG = {
'hvr_enabled': True,
}
hook_namespacing
Colocated JS-hook naming mode (lax bare names, or strict prefixes). str
Type
str
Default
'lax'
Colocated JS-hook naming: 'lax' uses bare hook names; 'strict' prefixes them with the view's module + qualname to avoid collisions. Per-tag opt-out via {% colocated_hook 'X' global %}.
DJUST_CONFIG = {
'hook_namespacing': 'strict',
}
websocket_compression
Declares intent to use WebSocket permessage-deflate (actual negotiation happens in the ASGI server). bool
Type
bool
Default
True
Declares intent to use WebSocket permessage-deflate (actual negotiation happens in the ASGI server). Costs ~64KB context per connection; disable at extreme connection density.
DJUST_CONFIG = {
'websocket_compression': True,
}
suppress_checks
System-check IDs to silence (e.g. list[str]
Type
list[str]
Default
[] (opt-in; no framework default)
System-check IDs to silence (e.g. ['C013', 'T002']). Unlike the keys above it has no framework default — it's an opt-in list you add when a project deliberately skips a checked feature, such as serving client.min.js from a CDN.
DJUST_CONFIG = {
'suppress_checks': ['C013'],
}
service_worker
Service-Worker features: VDOM snapshot cache and back-nav state restore. dict
Type
dict
Default
{'main_selector': 'main', 'shell_cache_name': 'djust-shell-v1', 'reconnect_buffer_cap': 50, 'vdom_cache_enabled': True, 'vdom_cache_ttl_seconds': 1800, 'vdom_cache_max_entries': 50, 'state_snapshot_enabled': True}
Service-Worker features: vdom_cache_enabled serves per-URL HTML snapshots instantly on popstate (reconciled against the live mount); state_snapshot_enabled powers back-button state restoration with LiveView.enable_state_snapshot.
DJUST_CONFIG = {
'service_worker': {
'vdom_cache_enabled': True,
'state_snapshot_enabled': True,
},
}