Home Features Docs Blog Philosophy Examples FAQ Live Demo Hosting
API Reference

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 class

Attributes 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).
# template_name

Type

str

Default

None

Path to the Django template for this view (relative to the template dirs). Either template_name or template is required.

Python
class ProfileView(LiveView):
    template_name = 'profile.html'
template An inline template string, rendered directly without a file lookup.
# template

Type

str

Default

None

An inline template string, rendered directly without a file lookup. Handy for tiny views or tests; use template_name otherwise.

Python
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.
# tick_interval

Type

int

Default

None

When set (milliseconds), handle_tick() is called periodically on the server — useful for clocks or status polling. None disables ticking.

Python
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.
# temporary_assigns

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.

Python
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.
# static_assigns

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.

Python
class DocsView(LiveView):
    static_assigns = ['catalog']
login_required When True, unauthenticated users are redirected to login_url before mount().
# login_required

Type

bool

Default

None

When True, unauthenticated users are redirected to login_url before mount(). Use permission_required for role checks.

Python
class Dashboard(LiveView):
    login_required = True
    login_url = '/login/'
permission_required Django permission string(s) checked after authentication; a single string or a list.
# permission_required

Type

str | list[str]

Default

None

Django permission string(s) checked after authentication; a single string or a list. Raises PermissionDenied if not met.

Python
class AdminView(LiveView):
    permission_required = ['app.view_data', 'app.change_data']
login_url Where to send unauthenticated users when login_required=True.
# login_url

Type

str

Default

None

Where to send unauthenticated users when login_required=True. Overrides settings.LOGIN_URL.

Python
class PrivateView(LiveView):
    login_required = True
    login_url = '/accounts/login/'
on_mount Hook functions run before mount() on every mount/reconnect, in MRO order.
# on_mount

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.

Python
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>/.
# api_name

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).

Python
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.
# api_auth_classes

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.

Python
class APIView(LiveView):
    api_name = 'endpoint'
    api_auth_classes = [TokenAuth(), SessionAuth()]
sticky Preserve this view's instance and DOM across live_redirect navigation.
# sticky

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.

Python
class SidebarView(LiveView):
    sticky = True
    sticky_id = 'main_sidebar'
sticky_id Required when sticky=True.
# sticky_id

Type

str

Default

None

Required when sticky=True. Must match the dj-sticky-slot name in the destination template to preserve state across navigation.

Python
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).
# use_actors

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.

Python
class CounterView(LiveView):
    use_actors = True
enable_state_snapshot Opt in to back-navigation state restoration via the Service Worker.
# enable_state_snapshot

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.

Python
class FilteredList(LiveView):
    enable_state_snapshot = True
streaming_render Return a chunked StreamingHttpResponse from HTTP GET for faster first paint.
# streaming_render

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.

Python
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.
# time_travel_enabled

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.

Python
class DebugView(LiveView):
    time_travel_enabled = True
abstract Marks an abstract base LiveView so system checks (e.g.
# abstract

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.

Python
class BaseFormView(LiveView):
    abstract = True
allowed_model_fields Restricts which attributes dj-model may bind.
# allowed_model_fields

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.

Python
class FormView(LiveView):
    allowed_model_fields = ['name', 'email', 'message']

DJUST_CONFIG settings

Project-wide defaults in settings.py

Project-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.
# css_framework

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.

Python
DJUST_CONFIG = {
    'css_framework': 'tailwind',
}
event_security How strictly event handlers must be marked (open / warn / strict).
# event_security

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.

Python
DJUST_CONFIG = {
    'event_security': 'strict',
}
max_message_size Maximum size in bytes for an incoming WebSocket message (0 = unlimited).
# max_message_size

Type

int

Default

65536

Maximum size in bytes for an incoming WebSocket message (0 = unlimited). Default 64KB; protects against memory exhaustion from oversized payloads.

Python
DJUST_CONFIG = {
    'max_message_size': 131072,  # 128KB
}
rate_limit Global WebSocket rate limiting.
# rate_limit

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.

Python
DJUST_CONFIG = {
    'rate_limit': {'rate': 50, 'burst': 10},
}
serialization_max_depth Maximum depth for nested model serialization (e.g.
# serialization_max_depth

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.

Python
DJUST_CONFIG = {
    'serialization_max_depth': 2,
}
strict_serialization When False, non-serializable values are coerced via str() with a warning.
# strict_serialization

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.

Python
DJUST_CONFIG = {
    'strict_serialization': True,
}
jit_serialization Enables JIT auto-serialization of Django models by the Rust engine at render time.
# jit_serialization

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.

Python
DJUST_CONFIG = {
    'jit_serialization': True,
}
jit_cache_backend Where compiled JIT serializers are cached (filesystem or redis).
# jit_cache_backend

Type

str

Default

'filesystem'

Where compiled JIT serializers are cached: 'filesystem' (default, fine for most) or 'redis' (for multi-worker deployments).

Python
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.
# hot_reload

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.

Python
DJUST_CONFIG = {
    'hot_reload': True,
}
hvr_enabled Hot View Replacement — state-preserving Python code reload in dev.
# hvr_enabled

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.

Python
DJUST_CONFIG = {
    'hvr_enabled': True,
}
hook_namespacing Colocated JS-hook naming mode (lax bare names, or strict prefixes).
# hook_namespacing

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 %}.

Python
DJUST_CONFIG = {
    'hook_namespacing': 'strict',
}
websocket_compression Declares intent to use WebSocket permessage-deflate (actual negotiation happens in the ASGI server).
# websocket_compression

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.

Python
DJUST_CONFIG = {
    'websocket_compression': True,
}
suppress_checks System-check IDs to silence (e.g.
# suppress_checks

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.

Python
DJUST_CONFIG = {
    'suppress_checks': ['C013'],
}
service_worker Service-Worker features: VDOM snapshot cache and back-nav state restore.
# service_worker

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.

Python
DJUST_CONFIG = {
    'service_worker': {
        'vdom_cache_enabled': True,
        'state_snapshot_enabled': True,
    },
}