// readme

djust brings Phoenix LiveView-style reactive views to Django. You write server-side Python; the browser updates itself over a WebSocket. There is no JavaScript to write, no bundler, and no build step in your project.

djust.org Β· Documentation Β· Quick Start Β· Examples

from djust import LiveView, event_handler

class CounterView(LiveView):
    template = """
    <div dj-root>
        <h1>Count: {{ count }}</h1>
        <button dj-click="increment">+</button>
        <button dj-click="decrement">-</button>
    </div>
    """

    def mount(self, request, **kwargs):
        self.count = 0

    @event_handler
    def increment(self):
        self.count += 1  # the page updates; no JavaScript

    @event_handler
    def decrement(self):
        self.count -= 1

Why djust

  • One codebase. Views, state and event handlers are Python. No API layer, no frontend build.
  • Small wire traffic. A Rust virtual DOM diffs each render and sends only the changed patches.
  • Fast templates. A Rust template engine renders Django templates…