Registry / web-framework / inertia-django

inertia-django

JSON →
library1.2.0pypypi✓ verified 83d ago

Django adapter for the Inertia.js framework to build single-page-app-like experiences without an API. Current version 1.2.0, supports Python >=3.8 <4.0, release cadence is irregular.

pip install inertia-django
INSTALL
IMPORT
SIG · INERTIA-DJANGO
I
inertia-django
web-frameworkpythonv1.2.0
Install
3.9s avg
Import
1254ms
Disk
69MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 1.330s · 69.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.9s · import 1.178s · 70MB
69MB installed
● package 69MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

InertiaMiddleware
from inertia.middleware import InertiaMiddleware
from inertia.middleware import inertia_middleware
Class name is camelcase, not snakecase
render_inertia
from inertia import render_inertia
share
from inertia import share

Minimal view returning Inertia response

from inertia import render_inertia from django.views import View class HomeView(View): def get(self, request): return render_inertia(request, 'Home', {'user': {'name': 'John'}})
Debug
Known issues
breakingIn version 1.0 the package was renamed from `django-inertia` to `inertia-django` and the internal module structure changed. All imports from `inertia` must be updated.
fix
Update imports: `from inertia import ...`
affects: <1.0
gotchaCSRF token handling: Inertia expects the CSRF token to be sent via the `X-CSRFToken` header, not the cookie alone. Missing middleware configuration will cause 403 errors.
fix
Ensure `django.middleware.csrf.CsrfViewMiddleware` is enabled and your frontend sends the header.
affects: >=0.3
deprecatedThe `inertia.contrib` submodule is deprecated and will be removed in a future release. Use the core `inertia` module directly.
fix
Replace `from inertia.contrib import ...` with `from inertia import ...`
affects: >=1.1
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'inertia'
Package not installed or imported using old name (`django-inertia`).
fix
Install `inertia-django` and import as `from inertia import ...`
TemplateDoesNotExist at /
Inertia view returned a template response instead of Inertia response because `render_inertia` was not used.
fix
Use `render_inertia(request, component_name, props)` instead of `render(request, template)`
CSRF Failed: CSRF token missing or incorrect.
The Inertia frontend did not send the CSRF token in the `X-CSRFToken` header.
fix
Ensure your frontend reads the CSRF token from the cookie and sets the header on every request.
Upgrade
Version history
1.2.0latest on PyPI · released Mar 25, 2025
Audit
Dependencies
djangorequiredCore framework dependency
inertia-corerequiredServer-side Inertia protocol handling
Agent activity
12 hits · last 30 days
node
12
Resources
inertia-django — pip install inertia-django · libregistry