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

# Other settings
DJANGO_VITE_PLUGIN = {
    'WS_CLIENT': '@vite/client',
    'DEV_MODE': getattr(settings, 'DEBUG', True),
    'BUILD_DIR': getattr(settings, 'STATIC_ROOT') or 'static',
    'BUILD_URL_PREFIX': getattr(settings, 'STATIC_URL'), # Bundled assets would be prefixed with this on production
    'SERVER': {
        'HTTPS': False,
        'HOST': '127.0.0.1',
        'PORT': 5173
    },
    'JS_ATTRS': {
        'type': 'module'
    },
    'CSS_ATTRS': {
        'rel' : 'stylesheet',
        'type': 'text/css'
    },
    '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.

Release files for django-vite-plugin 4.1.2

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 4.1.2
File Size Uploaded
django_vite_plugin-4.1.2.tar.gz 7.0 kB Details

Built distribution (wheel)

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

Total release size: 19.2 kB

Release files / django_vite_plugin-4.1.2.tar.gz

Download URL django_vite_plugin-4.1.2.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
90dd9de1c89eebadb4db49226ee8ce6c3b962ded0bb9991ef957e55af71c289f
BLAKE2b-256 checksum
How to use checksums
b321323689be25f289a4f44ed5622ddf3a9c34cc5d837d196264f3fd8c3a7d20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

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

Download URL django_vite_plugin-4.1.2-py3-none-any.whl
Size 12.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e1c3242bae9ddab61b9ce155c446992dbfc5d6e7ed14fcd07bc86c213dae70d8
BLAKE2b-256 checksum
How to use checksums
e5bbbf3f960a66f57b764888352c226ef7d999c5ef591e11ee187d367304c55a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.7

Release history Release notifications | RSS feed

This release

4.1.2 This release

2 release files

4.1.1

2 release files

4.1.0

2 release files

4.0.5

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.0.1

2 release files

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