Hi, welcome.¶
You're probably here because you love Django — the ORM, the admin, the migrations, the way it just works — but you also want a modern, reactive frontend without writing React, Vue, or shipping a separate Node app.
That's exactly what reflex-django is for.
You keep writing Django. You write your UI in Python using Reflex. They run as one program, on one port, and your Django session is the same session your buttons see. No CORS, no token gymnastics, no second dev server in another terminal.
What you'll actually write¶
Three files. That's the whole shape of a reflex-django project:
# config/settings.py — register reflex_django like any other app
INSTALLED_APPS = [..., "reflex_django", "shop"]
# config/urls.py — one line wires Reflex in
from reflex_django.urls import reflex_mount
urlpatterns = [path("admin/", admin.site.urls)]
urlpatterns += [reflex_mount(app_name="shop")]
# shop/views.py — your pages live here, next to your models
import reflex as rx
from reflex_django import template
from reflex_django.state import AppState
class HomeState(AppState):
@rx.event
async def on_load(self):
if self.request.user.is_authenticated:
self.greeting = f"Hi, {self.request.user.get_username()}!"
@template(route="/", title="Home")
def index() -> rx.Component:
return rx.heading(HomeState.greeting)
Then:
That's it. Open http://localhost:8000/. Your admin is at /admin/. Your reactive UI is at /. They share cookies, sessions, and the same Python process.
Pick a path¶
I want to understand first
Read why reflex-django exists, how Django and Reflex actually work, and where they meet. ~10 minutes, no code.
Just show me the code
Build a small todo app from scratch in about 15 minutes. You'll touch pages, state, auth, and the database.
I have a Django app already
Add a reflex-django page to a real, brownfield Django project without touching your models.
A suggested reading order¶
If you're new and you'd like a guided tour, this is the path most people find easiest:
- Why reflex-django exists — the one-page story
- How Django works in 5 minutes — skip this if Django is your day job
- How Reflex works in 5 minutes — skip this if Reflex is your day job
- How the two fit together — the bridge, in plain English
- Install and Your first app
- The Essentials — pages, state, the database, auth
Then drop into the build guides when you actually need them — CRUD pages, forms, i18n, deployment.
Looking for something specific?¶
| I want to… | Read |
|---|---|
| Configure ports, app name, prefixes | Configuration |
| Put pages next to my Django models | Pages live in views.py |
Read request.user inside a button handler |
AppState: your bridge to Django |
| Build a list/edit/delete page fast | CRUD with ModelState |
| Understand the WebSocket plumbing | The WebSocket event pipeline |
| Deploy to one container | Deployment |
Look up a REFLEX_DJANGO_* setting |
Settings reference |
| See every public symbol | Public API at a glance |