Skip to main content

Run a Django backend (Django ORM, Django Admin) alongside a Reflex app.

Project description

reflex-django

Keep Django. Get a reactive UI in Python. One command, shared cookies, native Reflex dev.

PyPI Python Docs License

Documentation · GitHub · PyPI


What is reflex-django?

reflex-django is a Reflex plugin that runs your Django project and Reflex UI together. You keep Django for models, admin, auth, and APIs. You build the frontend in Python with Reflex components and state.

One dev command (reflex run) starts both sides. Sessions and cookies are shared, so a user logged in through Django is logged in on Reflex pages. Event handlers on AppState read self.request.user like a Django view.

The plugin wires four pieces automatically (embed, mount, proxy, bridge). Set profile: "integrated" in rxconfig.py and you get port 3000 dev, SPA routing, and Django middleware on every Reflex event.

Install

uv add reflex-django

Or with pip (you also need Django and Reflex):

pip install reflex-django django reflex

New project with uv:

uv add django reflex reflex-django

Quick start

rxconfig.py:

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",
        }),
    ],
)

Then:

  1. Add reflex_django to INSTALLED_APPS and put AsyncStreamingMiddleware last in MIDDLEWARE (full setup)
  2. Create shop/shop.py with app = rx.App() and app.add_page(...) (pages and state)
  3. Run reflex django migrate and reflex run
  4. Open http://localhost:3000/

Learn each integration piece step by step →

API guides: Serializers · Model state · Auth · Config


Commands

reflex run
reflex export
reflex django migrate
reflex django createsuperuser

Requirements

Version
reflex-django 4.0+
Python 3.12+
Django 6.0+
Reflex 0.9.4+

Author: Mohannad Irshedat · Docs

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reflex_django-4.0.1.tar.gz (214.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

reflex_django-4.0.1-py3-none-any.whl (213.3 kB view details)

Uploaded Python 3

File details

Details for the file reflex_django-4.0.1.tar.gz.

File metadata

  • Download URL: reflex_django-4.0.1.tar.gz
  • Upload date:
  • Size: 214.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for reflex_django-4.0.1.tar.gz
Algorithm Hash digest
SHA256 0d6541963b767da83b9f701017fb4879e5b62d79739acde1fb76bd49a999a900
MD5 bdf2ef5c843b669f40ce016e92b3827e
BLAKE2b-256 7eb3d0bfb6a6475da24f4928372f5cc295c53590c22dd1d9d8f645296e91de3a

See more details on using hashes here.

File details

Details for the file reflex_django-4.0.1-py3-none-any.whl.

File metadata

  • Download URL: reflex_django-4.0.1-py3-none-any.whl
  • Upload date:
  • Size: 213.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.0 {"installer":{"name":"uv","version":"0.11.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for reflex_django-4.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 38f10a9cf98f2936871fbf92e4918069fe5cfb3ba6bc4e689d69f22279427d7d
MD5 42c234b83fc0a4d4b34aa0e6fb26b7e8
BLAKE2b-256 95c179f8e794a2e5dfba908507597d544d221e0d7b1736f27c1bc68214c0a121

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page