Utilities and helpers for integrating Django + Vue
Project description
Provides helpers and utilities for integrating with a Vue front-end, as described in the article Django + Vue + Vite: REST Not Required and in Cookiecutter Vue + Django
Quick start
Add dependency django-vue-utils
pip install django-vue-utils==0.1.8
Add “django_vue_utilities” to your INSTALLED_APPS setting:
INSTALLED_APPS = [
...,
"django_vue_utilities",
]
Settings
Tailor the following settings to your Vue front-end. The defaults are provided below.
VUE_FRONTEND_USE_TYPESCRIPT = False
VUE_FRONTEND_USE_DEV_SERVER = settings.DEBUG
VUE_FRONTEND_DEV_SERVER_URL = 'http://localhost:5173'
VUE_FRONTEND_DEV_SERVER_PATH = 'src'
VUE_FRONTEND_STATIC_PATH = 'vue'
Usage
{% extends "base.html" %}
{% load vue_utils %}
{% block extra_js %}
{# Import entrypoint JavaScript, choosing dev or static source depending on settings #}
<script type="module" crossorigin src="{% vue_bundle_url 'my_vue_entrypoint' %}"></script>
{# 'provide" strings which can 'injected' throughout the Vue app, including from within a pinia store #}
{% url 'home' as homeUrl %}
{% vue_provide 'homeUrl' homeUrl %}
{% endblock %}
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file django-vue-utils-0.1.8.tar.gz.
File metadata
- Download URL: django-vue-utils-0.1.8.tar.gz
- Upload date:
- Size: 2.8 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b92bb467b8ca47e408ca6ede3134ecd7d11efd52dc7300c826c72354f197e47
|
|
| MD5 |
3c9efa97513364294a16ea29000ebb3c
|
|
| BLAKE2b-256 |
1dff36dd5967ad1c943745ae1390eca3311257e71b7aa1d1ff86c561f77ae267
|