Skip to main content

Django Vite Plugin

PyPI version

Introduction

Vite is a modern frontend build tool that provides an extremely fast development environment and bundles your code for production.

This plugin configures Vite for use with Django backend.

Installation

pip install django_vite_plugin

Then in your projects settings.py file, add django_vite_plugin in installed apps

# Some settings
INSTALLED_APPS = [
    # Some apps
    'django_vite_plugin',
    # Other apps
]

These are the available configuration options, shown with their defaults

# Other settings
DJANGO_VITE_PLUGIN = {
    # Load assets from the Vite dev server instead of a build
    'DEV_MODE': DEBUG,
    # Where Vite builds to. A relative path is resolved against BASE_DIR
    'BUILD_DIR': STATIC_ROOT or 'static',
    # Where Vite writes its manifest, resolved against BASE_DIR
    'MANIFEST': None,  # -> BUILD_DIR/.vite/manifest.json
    # Bundled assets are prefixed with this on production
    'BUILD_URL_PREFIX': STATIC_URL,
    # Where Vite writes the URL it is running at, resolved against BASE_DIR.
    # The dev server address itself is Vite's to choose - set `server.host`
    # and `server.port` in vite.config.js, not here
    'HOT_FILE': None,  # -> BASE_DIR/.hotfile
    'WS_CLIENT': '@vite/client',
    'JS_ATTRS': {
        'type': 'module'
    },
    # Unset by default; when given, merged over JS_ATTRS if DEV_MODE is off.
    # Set an attribute to None to drop one of the defaults.
    # 'JS_ATTRS_BUILD': {'defer': True},
    'CSS_ATTRS': {
        'rel' : 'stylesheet',
        'type': 'text/css'
    },
    # Resolve asset paths through Django's static file finders
    'STATIC_LOOKUP': True
}

See the official documentation for more details

Usage

<!--Your Template file-->
{% load vite %}
<!DOCTYPE html>
<html lang="en">
    <head>
        <!--Other elements-->
        <!--Vite dev client for hmr (will not be displayed on production)-->
        {% vite %}
        <!--These attributes will be present in both `asset1.css` & `asset2.js`-->
        {% vite 'asset1.css' 'asset2.js' someattr='value' %}
    </head>
    <body>
        <!--Page content-->
    </body>
</html>

Official Documentation

Documentation for the Django Vite plugin can be found on the Github.

License

The Django Vite plugin is open-sourced software licensed under the MIT license.

Metadata

Release files for django-vite-plugin 5.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-vite-plugin 5.0.0
File Size Uploaded Provenance
django_vite_plugin-5.0.0.tar.gz 24.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-vite-plugin 5.0.0
File Interpreter ABI Platform
django_vite_plugin-5.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 39.5 kB

Release files / django_vite_plugin-5.0.0.tar.gz

Download URL django_vite_plugin-5.0.0.tar.gz
Size 24.9 kB
Tags Source
SHA-256 checksum
How to use checksums
ec29900b34f23d4db65f72e71773cb6c2232bc41b197f99650794cccb3477294
BLAKE2b-256 checksum
How to use checksums
70fffc7f590cfedbadf74b00a1e86bbbee4b634d7621c35ce0d5bd9825215e34
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Release files / django_vite_plugin-5.0.0-py3-none-any.whl

Download URL django_vite_plugin-5.0.0-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba1d2ac6815f484bf311e56e67aebb8d207f12304d75cb662df5b202b2681e05
BLAKE2b-256 checksum
How to use checksums
70c931e3878798e6e2f6d23551ab9b813637b259408c435bf4c4a71f7d2d330a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.8

Security for django-vite-plugin 5.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page