{"id":23885,"library":"inertia-django","title":"Inertia Django","description":"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.","status":"active","version":"1.2.0","language":"python","source_language":"en","source_url":"https://github.com/inertiajs/inertia-django","tags":["inertia","django","spa","ssr"],"install":[{"cmd":"pip install inertia-django","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Core framework dependency","package":"django","optional":false},{"reason":"Server-side Inertia protocol handling","package":"inertia-core","optional":false}],"imports":[{"note":"Class name is camelcase, not snakecase","wrong":"from inertia.middleware import inertia_middleware","symbol":"InertiaMiddleware","correct":"from inertia.middleware import InertiaMiddleware"},{"note":null,"wrong":null,"symbol":"render_inertia","correct":"from inertia import render_inertia"},{"note":null,"wrong":null,"symbol":"share","correct":"from inertia import share"}],"quickstart":{"code":"from inertia import render_inertia\nfrom django.views import View\nclass HomeView(View):\n    def get(self, request):\n        return render_inertia(request, 'Home', {'user': {'name': 'John'}})","lang":"python","description":"Minimal view returning Inertia response"},"warnings":[{"fix":"Update imports: `from inertia import ...`","message":"In 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.","severity":"breaking","affected_versions":"<1.0"},{"fix":"Ensure `django.middleware.csrf.CsrfViewMiddleware` is enabled and your frontend sends the header.","message":"CSRF 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.","severity":"gotcha","affected_versions":">=0.3"},{"fix":"Replace `from inertia.contrib import ...` with `from inertia import ...`","message":"The `inertia.contrib` submodule is deprecated and will be removed in a future release. Use the core `inertia` module directly.","severity":"deprecated","affected_versions":">=1.1"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Install `inertia-django` and import as `from inertia import ...`","cause":"Package not installed or imported using old name (`django-inertia`).","error":"ModuleNotFoundError: No module named 'inertia'"},{"fix":"Use `render_inertia(request, component_name, props)` instead of `render(request, template)`","cause":"Inertia view returned a template response instead of Inertia response because `render_inertia` was not used.","error":"TemplateDoesNotExist at /"},{"fix":"Ensure your frontend reads the CSRF token from the cookie and sets the header on every request.","cause":"The Inertia frontend did not send the CSRF token in the `X-CSRFToken` header.","error":"CSRF Failed: CSRF token missing or incorrect."}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}