What is reflex-django?¶
reflex-django connects Django and Reflex so you run one app, not two servers you glue together by hand. Django owns your database, admin, session auth, and REST or API routes. Reflex owns reactive pages you write in Python.
Install the plugin, set profile: "integrated" in rxconfig.py, and run reflex run. Django admin, your API, and Reflex pages share cookies and sessions. Handlers on Django-aware state (AppState, ModelState, or DjangoUserState) see self.request.user when bridge is enabled and the resolved event tier binds Django context.
Install¶
For a new project, also add Django and Reflex (uv add django reflex reflex-django or pip install django reflex reflex-django). See Integration for the full layout.
Configure and run¶
import reflex as rx
from reflex_django.plugins import ReflexDjangoPlugin
config = rx.Config(
app_name="shop",
plugins=[
ReflexDjangoPlugin(
config={
"settings_module": "config.settings",
"profile": "integrated",
}
),
],
)
- Add
reflex_djangotoINSTALLED_APPSandAsyncStreamingMiddlewarelast (Integration) - Create
shop/shop.pywithapp = rx.App()andapp.add_page(...)(Pages and state) reflex django migratethenreflex run→ http://localhost:3000/
Learn step by step¶
1 · Integration
Install, wire settings, urls, and run your first app.
2 · Embed
Django admin and API inside the Reflex backend.
3 · Mount
URL prefixes and the SPA catch-all.
4 · Proxy
Port 3000 dev wiring and split dev.
5 · Bridge
Request context and the logged-in user in handlers.
Need serializers, auth pages, deploy help, security guidance, or migration notes? See Advanced.
For AI-assisted work, use the repository llm.txt guide as the compact source map.