Name | djvite JSON |
Version |
1.3.0
JSON |
| download |
home_page | None |
Summary | Integrates Vite resources into a Django web site. |
upload_time | 2025-09-05 12:30:07 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3.12 |
license | MIT License |
keywords |
django
javascript
vite
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
DjVite
======

Integrates [Vite](https://vite.dev/) resources into a [Django](https://www.djangoproject.com/) web site.
Web requests are first served through **vite** dev server, then either proxified to **django** dev server or served directly.
This simulates a **nginx** proxy and **wsgi** server.
How to use
----------
- Add `djvite` to your `INSTALLED_APPS` django config.
- Define your static directories:
```python
STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / 'static'
STATICFILES_DIRS = ['dist']
```
- Load the `djvite` plugin into your templates:
```html
<html>{% load djvite %}
...
</html>
```
- Inject any *script* or *link* from *vite* into your template:
- `{% vite hotreload %}` enables vite hot module reload in dev mode
- `{% vite '/src/main.js' %}`
- `{% vite '/src/style.css' %}`
- Add `DjVitePlugin` to your `vite.config.js` file:
```javascript
import { defineConfig } from 'vite'
import DjVitePlugin from 'djvite'
export default defineConfig({
plugins: [DjVitePlugin({verbose: true})],
})
```
Notes:
You can add any attributes to the `vite` tag and it will be added to the final tags.
You can specifiy multiple sources within one `vite` tag, separate them with spaces.
You can use the `get_nginx_config` command to generate a working nginx static configuration.
Configuration
-------------
In **django** settings:
- `DJVITE` dict, with the following keys:
- `DEV_MODE` (boolean, default `True`)
When `False`, resources are resolved using the `vite-manifest.json` file that list bundle files. This file is generated using `vite build`.
- `MODULE_EXTS` (extension list, default ot `['.js']`)
Use this to provide other extensions to be served as module, for instance `['.js', '.ts', '.jsx', '.tsx']` in Typescript React application.
- `VITE_MANIFEST_PATH` (`Path | str`, default to `vite.manifest.json`)
Location to search for the Vite manifest. Used when `DEV_MODE` is `False`.
In **vite** config plugin:
- `options` object for `DjVitePlugin`.
- `verbose` default to `false`.
- `djangoPort` default to `DJANGO_PORT` environment variable or `8000` if not defined.
- `djangoTemplatesGlob` default to the globbing pattern `**/templates`.
- `manifestPath` default to `vite.manifest.json`.
Raw data
{
"_id": null,
"home_page": null,
"name": "djvite",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "django, javascript, vite",
"author": null,
"author_email": "Cyrille Pontvieux <cyrille@enialis.net>",
"download_url": "https://files.pythonhosted.org/packages/f4/6a/dfdeee45a761bc9388a1d569ffeee69f4417091b7bd457473541b03c0365/djvite-1.3.0.tar.gz",
"platform": null,
"description": "DjVite\n======\n\n\n\nIntegrates [Vite](https://vite.dev/) resources into a [Django](https://www.djangoproject.com/) web site.\n\nWeb requests are first served through **vite** dev server, then either proxified to **django** dev server or served directly.\n\nThis simulates a **nginx** proxy and **wsgi** server.\n\nHow to use\n----------\n\n- Add `djvite` to your `INSTALLED_APPS` django config.\n- Define your static directories:\n```python\nSTATIC_URL = \"static/\"\nSTATIC_ROOT = BASE_DIR / 'static'\nSTATICFILES_DIRS = ['dist']\n```\n- Load the `djvite` plugin into your templates:\n```html\n<html>{% load djvite %}\n...\n</html>\n```\n- Inject any *script* or *link* from *vite* into your template:\n - `{% vite hotreload %}` enables vite hot module reload in dev mode\n - `{% vite '/src/main.js' %}`\n - `{% vite '/src/style.css' %}`\n- Add `DjVitePlugin` to your `vite.config.js` file:\n```javascript\nimport { defineConfig } from 'vite'\nimport DjVitePlugin from 'djvite'\nexport default defineConfig({\n plugins: [DjVitePlugin({verbose: true})],\n})\n```\n\nNotes:\n\nYou can add any attributes to the `vite` tag and it will be added to the final tags.\n\nYou can specifiy multiple sources within one `vite` tag, separate them with spaces.\n\nYou can use the `get_nginx_config` command to generate a working nginx static configuration.\n\nConfiguration\n-------------\n\nIn **django** settings:\n- `DJVITE` dict, with the following keys:\n - `DEV_MODE` (boolean, default `True`)\n When `False`, resources are resolved using the `vite-manifest.json` file that list bundle files. This file is generated using `vite build`.\n - `MODULE_EXTS` (extension list, default ot `['.js']`)\n Use this to provide other extensions to be served as module, for instance `['.js', '.ts', '.jsx', '.tsx']` in Typescript React application.\n - `VITE_MANIFEST_PATH` (`Path | str`, default to `vite.manifest.json`)\n Location to search for the Vite manifest. Used when `DEV_MODE` is `False`.\n\nIn **vite** config plugin:\n- `options` object for `DjVitePlugin`.\n - `verbose` default to `false`.\n - `djangoPort` default to `DJANGO_PORT` environment variable or `8000` if not defined.\n - `djangoTemplatesGlob` default to the globbing pattern `**/templates`.\n - `manifestPath` default to `vite.manifest.json`.\n",
"bugtrack_url": null,
"license": "MIT License",
"summary": "Integrates Vite resources into a Django web site.",
"version": "1.3.0",
"project_urls": {
"Bug Tracker": "https://gitlab.com/jrdasm/djvite/-/issues",
"Changelog": "https://gitlab.com/jrdasm/djvite/-/blob/master/CHANGELOG.md",
"Contributing": "https://gitlab.com/jrdasm/djvite/-/blob/master/CONTRIBUTING.md",
"Documentation": "https://gitlab.com/jrdasm/djvite/-/blob/master/README.md",
"Merge Requests": "https://gitlab.com/jrdasm/djvite/-/merge_requests",
"Repository": "https://gitlab.com/jrdasm/djvite"
},
"split_keywords": [
"django",
" javascript",
" vite"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "99c07e20f9e0100ff92dcdeda380a6353f643bc7ada02f6b0209eccb65e3995e",
"md5": "e9a7045594d011361b3f021d95ac444c",
"sha256": "1f3817099e4581e45e9a879bbda06669b1f6527805149fa8bb49fca30603996f"
},
"downloads": -1,
"filename": "djvite-1.3.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "e9a7045594d011361b3f021d95ac444c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 9574,
"upload_time": "2025-09-05T12:30:06",
"upload_time_iso_8601": "2025-09-05T12:30:06.534681Z",
"url": "https://files.pythonhosted.org/packages/99/c0/7e20f9e0100ff92dcdeda380a6353f643bc7ada02f6b0209eccb65e3995e/djvite-1.3.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "f46adfdeee45a761bc9388a1d569ffeee69f4417091b7bd457473541b03c0365",
"md5": "c950c389a094bbfad9e186cfd0595ea8",
"sha256": "e2ee0c6f4986d233689ac20db505325dda33b42a862293c892cdeb8d5909af92"
},
"downloads": -1,
"filename": "djvite-1.3.0.tar.gz",
"has_sig": false,
"md5_digest": "c950c389a094bbfad9e186cfd0595ea8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 7019,
"upload_time": "2025-09-05T12:30:07",
"upload_time_iso_8601": "2025-09-05T12:30:07.393213Z",
"url": "https://files.pythonhosted.org/packages/f4/6a/dfdeee45a761bc9388a1d569ffeee69f4417091b7bd457473541b03c0365/djvite-1.3.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-09-05 12:30:07",
"github": false,
"gitlab": true,
"bitbucket": false,
"codeberg": false,
"gitlab_user": "jrdasm",
"gitlab_project": "djvite",
"lcname": "djvite"
}