interlace

Django, but reactive.

Interactive, server-rendered components written in Python. HTML over the wire, no API, no build step, minimal JavaScript.

Counter.py
{% interlace "Counter" %}

A whole component, state, logic and template, in one Python class. Live, with no custom JavaScript.

Drag to reorder

Drag list items and lace:sort syncs the new order to the server for you. Built in, no sortable.js wiring. More →

SortableList.py
sortable_list.html
{% interlace "SortableList" %}

Drag steps to reorder. Changes sync to server automatically.

  • Add 200g flour
  • Mix in 2 eggs
  • Whisk until smooth

Add 200g flour, Mix in 2 eggs, Whisk until smooth

Forms and validation

Declare each field's rules with Django form fields, then validate as the user types by calling validate_only() from the updated() hook. More →

InstantValidation.py
instant_validation.html
{% interlace "InstantValidation" %}

Multi-root components

No required wrapper element. Return as many top-level nodes as you like and Interlace still morphs them, something single-root frameworks like django-unicorn can't do. More →

RootlessCounter.py
rootless_counter.html
{% interlace "RootlessCounter" %}

Clicked 0 times

Nested components

Compose components by nesting them; each child is an isolated instance. Children talk back to a parent with emit_to, addressing it by name. More →

NestList.py (parent)
NestRow.py (child)
{% interlace "NestList" %}
Write the docs
Ship it

Polling

Point lace:poll at a method and the component refreshes itself on an interval - live prices, no websockets. Every poll on the page shares one synchronized timer. More →

StockTicker.py
stock_ticker.html
{% interlace "StockTicker" %}
TCOR
$152.45
0.00
Updates every 2s

Live search

Bind a search box with a debounced lace:model, derive the filtered results in a @property, and render them with a loop. The same code runs over a queryset. More →

Search.py
search.html
{% interlace "Search" %}
  • Django Web Framework
  • React Frontend Library
  • Docker Containers
  • Python Language
  • GraphQL API

Two-way binding

Bind an input to a property with lace:model; the template updates as you type, no fetch calls. More →

Greeter.py
greeter.html
{% interlace "Greeter" %}

Hello, Ada

Test without a browser

Drive a component and assert on its state and rendered HTML in a plain Django test, no Selenium, no running server. More →

test_counter.py
$ manage.py test
Ran 1 test in 0.004s
OK

Inline template

State, logic and markup in one Python class, return the HTML from inline_template() instead of a separate .html file. More →

StarRating.py
{% interlace "StarRating" %}

Built on tools you already know

Django

Components are class-based views. Full ORM, forms, auth and templates, no new runtime to learn.

Alpine.js

A tiny client that morphs the DOM in place, preserving focus and scroll. Drop into any `@click` for local interactivity.

Start building

$ pip install django-interlace
Theme
Accent
Ink