{"repo":"MrBin99/django-vite","free":true,"listed":false,"github":"https://github.com/MrBin99/django-vite","clone":"git clone https://github.com/MrBin99/django-vite.git","description":"Integration of ViteJS in a Django project.","language":"Python","stars":837,"topics":["vitejs","django","vite","python"],"license":"Apache-2.0","category":"api-integrations-sdks","readme_excerpt":"Django Vite Integration of ViteJS in a Django project. - Installation - Django - ViteJS - Assets - Usage - Configuration - Dev Mode - Template tags - Custom attributes - Loading assets from a CDN - Vite Legacy Plugin - Multi-app configuration - Configuration Variables - dev\\ mode - dev\\ server\\ protocol - dev\\ server\\ host - dev\\ server\\ port - static\\ url\\ prefix - manifest\\ path - legacy\\ polyfills\\ motif - ws\\ client\\ url - react\\ refresh\\ url - app\\ client\\ class - Notes - Whitenoise - Examples - Thanks Installation Django Add django vite to your INSTALLED APPS in your settings.py (before your apps that are using it). ViteJS Follow instructions on https://vitejs.dev/guide/. And mostly the SSR part. Then in your ViteJS config file : - Set the base options the same as your STATIC URL Django setting. - Set the build.outDir path to where you want the assets to compiled. - Set the build.manifest options to manifest.json . - As you are in SSR and not in SPA, you don't have an index.html that ViteJS can use to determine which files to compile. You need to tell it directly in build.rollupOptions.input . Assets As recommended on Vite's backend integration guide, your assets should include the modulepreload polyfill. Usage Configuration Define a default DJANGO VITE configuration in your settings.py . Or if you prefer to use the legacy module-level settings, you can use: Be sure that the build.outDir from vite.config.js is included in STATICFILES DIRS . Dev Mode The dev mode / DJANG","default_branch":null,"files":null,"tree":[],"storefront":"/r/MrBin99","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/MrBin99/django-vite/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}