Skip to content

API Reference

This page contains the API reference documentation for the RouteLit Django adapter.

RouteLitDjangoAdapter

routelit_django.adapter.RouteLitDjangoAdapter(routelit, *, static_path=None, template_path=get_default_template_path(), run_mode='prod', local_frontend_server=None, local_components_server=None, cookie_config=None)

A Django adapter for the RouteLit framework, enabling seamless integration of RouteLit's reactive UI components with Django web applications.

configure(urlpatterns)

Configure the Django application to use the RouteLitDjangoAdapter. This adds the necessary URL patterns for static assets.

response(view_fn, request, inject_builder=None, *args, **kwargs)

stream_response(view_fn, request, inject_builder=None, *args, **kwargs)

DjangoSessionStorage

routelit_django.storage.DjangoSessionStorage()

Bases: MutableMapping[str, Any]

A RouteLit session storage implementation that delegates to the current Django request session. It uses a context variable to access the session of the current request.

DjangoRouteLitRequest

routelit_django.request.DjangoRouteLitRequest(request)

Bases: RouteLitRequest

Implements the RouteLitRequest interface for Django.

method property

get_headers()

get_path_params()

get_referrer()

get_json()

get_files()

is_json()

is_multipart()

get_query_param(key)

get_query_param_list(key)

get_session_id()

get_pathname()

get_host()

RunMode

routelit_django.adapter.RunMode = Literal['prod', 'dev_client', 'dev_components'] module-attribute

RunModeEnum

routelit_django.adapter.RunModeEnum

Bases: Enum

Exports

The following are exported from the routelit_django package:

from routelit_django import (
    RouteLitDjangoAdapter,    # Main adapter class
    DjangoSessionStorage,     # Session storage implementation
    DjangoRouteLitRequest,    # Request wrapper
    RunMode,                  # Literal type for run modes
    RunModeEnum,              # Enum for run modes
)