django-vite
Integration of Vite in a Django project.
What it is and what it does
Django-vite bridges Django's static file system with Vite, a modern frontend build tool. It provides template tags to load JavaScript and CSS assets, with automatic hot module replacement (HMR) during development and manifest-based asset resolution in production. The package handles the communication between Django's template layer and Vite's dev server or compiled manifest, letting you write modern ES6 modules and use Vite's fast rebuild cycles without leaving Django.
The package is configured through Django settings and works by either serving assets directly from Vite's dev server in development mode (enabling HMR) or reading a manifest.json file in production to resolve compiled asset paths. It supports custom attributes on script tags, React refresh, and loading assets from CDNs via custom manifest clients. The single runtime dependency is Django itself.
Use it for:
- Enable hot module replacement for JavaScript during Django development without rebuilding the entire frontend on each change
- Manage CSS and JavaScript dependencies using Vite's ES6 module system while serving them through Django templates
- Build and optimize frontend assets for production using Vite's tree-shaking and code-splitting, then reference them in Django via manifest.json
- Serve frontend assets from a CDN like S3 by subclassing the manifest client to fetch compiled assets from non-standard sources
- Support React development with automatic HMR using the vite_react_refresh template tag
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Integrates Vite, a modern JavaScript build tool, into Django projects to serve and build frontend assets with hot module replacement during development and optimized production builds.
Yes, if you are building a Django project with modern JavaScript and want Vite's development experience (fast rebuilds, HMR) without ejecting from Django. The package is stable, has low install friction, and carries no security vulnerabilities. The aging maintenance status is not a blocker—the last commit was recent (2025-05-09) and the package is relatively simple. Install it if your workflow requires Vite; skip it if you are using Django's default static file handling or a different frontend build tool.
Install
django-vite on PyPI
pip
pip install django-viteuv
uv add django-vitepoetry
poetry add django-viteInstalling django-vite
Before you install
Low install friction; pure Python wheel with only Django as a runtime dependency. Last commit was 2025-05-09 and the package is classified as aging, indicating it is maintained but not actively developed.
License in practice
Licensed under Apache License, Version 2.0 (permissive). You can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install django-vite
# In settings.py
INSTALLED_APPS = [
'django_vite',
...
]
DJANGO_VITE = {"default": {"dev_mode": True}}
# In template
{% load django_vite %}
{% vite_hmr_client %}
{% vite_asset 'path/to/script' %}
Requires a separate Vite configuration file (vite.config.js) and Node.js toolchain; Django-vite is the Python integration layer only.
Verify before relying
- Specific performance impact of HMR client on development server startup time or memory usage
- Compatibility with specific Vite plugins beyond React refresh mentioned in the documentation
- Whether the package works with Django versions prior to 3.2 despite classifiers listing 3.2 as minimum
Package facts
| License | Apache License, Version 2.0 (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — Django |
| Maintenance | aging — 537 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,095,601/month — #4,374 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: django_vite-3.1.0-py3-none-any.whl
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
django-tailwindIntegrates Tailwind CSS into Django projects…
permissive · top 15,000 on PyPI
django-js-assetAdds script, stylesheet, and JSON tags with…
permissive · top 5,000 on PyPI
Flask-AssetsIntegrates asset management into Flask…
permissive · top 15,000 on PyPI
django-webpack-loaderIntegrates Webpack-compiled bundles into Django…
permissive · top 5,000 on PyPI
django-jinjaIntegrates Jinja2 templating into Django,…
permissive · top 15,000 on PyPI
django-pipelinedjango-pipeline bundles and compresses CSS and…
permissive · top 15,000 on PyPI
django-compressorDjango Compressor combines, minifies, and…
permissive · top 5,000 on PyPI
webassetsMerges and compresses JavaScript and CSS files…
permissive · top 15,000 on PyPI
django-componentsdjango-components lets you build reusable,…
permissive · top 15,000 on PyPI
crispy-bootstrap3Provides Bootstrap 3 HTML templates for…
permissive · top 15,000 on PyPI