\n
\n {% endif %}\n\n\n```\n\n## Vite Configuration\n\nCross-Inertia expects a standard Vite configuration:\n\n```ts\n// vite.config.ts\nimport { defineConfig } from 'vite'\nimport react from '@vitejs/plugin-react'\n\nexport default defineConfig({\n plugins: [react()],\n build: {\n manifest: true,\n outDir: 'static/build',\n rollupOptions: {\n input: 'frontend/app.tsx',\n },\n },\n server: {\n // Cross-Inertia picks the port; make relative asset URLs (fonts, images\n // referenced from CSS) resolve against Vite rather than your backend.\n origin: process.env.INERTIA_VITE_URL,\n strictPort: true,\n },\n})\n```\n\n### Vite dev server URL\n\nWhen Cross-Inertia starts Vite it appends `--port ` to `vite_command` and\nexports the resolved URL as `INERTIA_VITE_URL`. Use it for `server.origin` so\nasset URLs Vite emits in development point at Vite instead of your app. There\nis no need to hard-code the selected port.\n\nDo not set `server.port` in `vite.config` when using `vite_port=\"auto\"`; the CLI\nflag wins anyway, and a hard-coded value only misleads. `strictPort: true` is\nfine \u2014 it applies to the port Cross-Inertia passed.\n\nThe Django adapter reads the same `InertiaConfig` defaults for its shared\nsettings, so both adapters behave the same out of the box. The one contextual\ndefault is `ASSET_URL_PREFIX`, which Django derives from `STATIC_URL` unless it\nis explicitly configured.\n\n## Exceptions\n\n### ManifestNotFoundError\n\nRaised when the Vite manifest file is missing in production mode:\n\n```python\nfrom cross_inertia import ManifestNotFoundError\n\ntry:\n # Render in production without building first\n return inertia.render(\"Home\", {})\nexcept ManifestNotFoundError:\n # Handle missing manifest - typically means you forgot to run `vite build`\n pass\n```\n\n## Migration from InertiaResponse\n\nIf you're upgrading from an older version that used `InertiaResponse` directly:\n\n**Before (deprecated):**\n\n```python\nimport inertia._core\n\ninertia_response = inertia._core.InertiaResponse(\n template_dir=\"templates\",\n vite_dev_url=\"http://localhost:5173\",\n)\ninertia._core._inertia_response = inertia_response\n```\n\n**After (recommended):**\n\n```python\nfrom cross_inertia import configure_inertia\n\nconfigure_inertia(\n template_dir=\"templates\",\n vite_port=5173,\n)\n```\n\nThe new approach:\n- Uses a public API instead of private internals\n- Provides consistent configuration for both rendering and lifespan management\n- Supports auto port selection\n- Is the recommended pattern going forward", "toc": [{"id": "configure-inertia", "text": "configure_inertia()", "level": 2}, {"id": "parameters", "text": "Parameters", "level": 2}, {"id": "vite-settings", "text": "Vite Settings", "level": 3}, {"id": "template-settings", "text": "Template Settings", "level": 3}, {"id": "ssr-settings", "text": "SSR Settings", "level": 3}, {"id": "returns", "text": "Returns", "level": 2}, {"id": "examples", "text": "Examples", "level": 2}, {"id": "basic-configuration", "text": "Basic Configuration", "level": 3}, {"id": "auto-port-selection", "text": "Auto Port Selection", "level": 3}, {"id": "full-configuration", "text": "Full Configuration", "level": 3}, {"id": "with-lifespan-management", "text": "With Lifespan Management", "level": 3}, {"id": "get-config", "text": "get_config()", "level": 2}, {"id": "inertiaconfig", "text": "InertiaConfig", "level": 2}, {"id": "template-variables", "text": "Template Variables", "level": 2}, {"id": "vite-configuration", "text": "Vite Configuration", "level": 2}, {"id": "vite-dev-server-url", "text": "Vite dev server URL", "level": 3}, {"id": "exceptions", "text": "Exceptions", "level": 2}, {"id": "manifestnotfounderror", "text": "ManifestNotFoundError", "level": 3}, {"id": "migration-from-inertiaresponse", "text": "Migration from InertiaResponse", "level": 2}]}, "nav": [{"title": "Getting Started", "items": [{"title": "Introduction", "href": "/docs/"}, {"title": "Quick Start", "href": "/docs/quick-start/"}, {"title": "Django", "href": "/docs/django/"}, {"title": "Installation", "href": "/docs/installation/"}]}, {"title": "Core Concepts", "items": [{"title": "Pages", "href": "/docs/pages/"}, {"title": "Shared Data", "href": "/docs/shared-data/"}, {"title": "Links & Navigation", "href": "/docs/links/"}, {"title": "Forms", "href": "/docs/forms/"}]}, {"title": "Advanced", "items": [{"title": "Server-Side Rendering", "href": "/docs/ssr/"}, {"title": "SSR Lifespan", "href": "/docs/ssr-lifespan/"}, {"title": "Deferred Props", "href": "/docs/deferred-props/"}, {"title": "Experimental Lifespan Management", "href": "/docs/experimental-lifespan/"}, {"title": "History Encryption", "href": "/docs/history-encryption/"}, {"title": "Once Props", "href": "/docs/once-props/"}]}, {"title": "API Reference", "items": [{"title": "Inertia Class", "href": "/docs/api/inertia/"}, {"title": "Shared Data (FastAPI)", "href": "/docs/api/middleware/"}, {"title": "Configuration", "href": "/docs/api/configuration/"}]}, {"title": "Other", "items": [{"title": "Always Props", "href": "/docs/always-props/"}, {"title": "External Redirects", "href": "/docs/external-redirects/"}, {"title": "Frontend Setup", "href": "/docs/frontend-setup/"}, {"title": "Merge Props & Infinite Scroll", "href": "/docs/merge-props/"}, {"title": "Partial Reloads", "href": "/docs/partial-reloads/"}, {"title": "Prefetching", "href": "/docs/prefetching/"}, {"title": "Testing", "href": "/docs/testing/"}, {"title": "Validation Errors", "href": "/docs/validation-errors/"}, {"title": "View Data", "href": "/docs/view-data/"}]}], "currentPath": "/docs/api/configuration/", "logoUrl": "/static/logo.svg", "logoInvertedUrl": "/static/logo-inverted.svg", "footerLogoUrl": "/static/logo-full.svg", "footerLogoInvertedUrl": "/static/logo-inverted.svg", "githubUrl": "https://github.com/patrick91/cross-inertia", "navLinks": [{"label": "Docs", "href": "/docs"}]}, "url": "/docs/api/configuration/", "version": "f83124f236843b928916c1245f336129", "encryptHistory": false, "clearHistory": false}