Quickstart
Get up and running with Interlace in minutes. This guide will walk you through installation, configuration, and building your first reactive component.
1. Install Interlace
pip install django-interlace
2. Configure Django
Update your settings.py to include Interlace:
settings.py
INSTALLED_APPS = [
...
'interlace',
]
MIDDLEWARE = [
...
'interlace.middleware.InterlaceMiddleware',
]
Add Interlace URLs to your project's urls.py:
urls.py
from django.urls import path, include
from interlace import urls as interlace_urls
urlpatterns = [
...
path('interlace/', include(interlace_urls)),
]
3. Create a component
Create a new file components/Counter.py (or anywhere in your app):
components/Counter.py
from interlace import Component
class Counter(Component):
count: int = 0
def increment(self):
self.count += 1
def inline_template(self):
return """
<div>
{{ count }}
<button lace:click="increment">
Increment
</button>
</div>
"""
4. Render it
In any Django template, load the tag library and render your component:
template.html
{% load interlace %}
<!DOCTYPE html>
<html>
<body>
<h1>My App</h1>
{% interlace "my_app.components.Counter" %}
</body>
</html>
What's Next? Now that you have a basic component working, explore the core concepts to build more complex interfaces. Learn more about Components →