PointOfVue
A simple, opinionated way to incorporate VueJS into your Django applications
Installation
pip install PointOfVue
Add pointofvue to your Django installed apps:
INSTALLED_APPS = [
# other apps ...
'pointofvue',
]
Basic Usage
In your view, import pointofvue and send a pointofvue.VueContext instance to your template
import pointofvue
def view_handler(request):
vue_ctx = pointofvue.VueContext()
vue_ctx.set_data('var1', 'My value')
return render(request, 'template.html', {
"vue_ctx": vue_ctx,
})
In your template, write your Vue code in a #app element and use ${ and } for accessing Vue data. Then load the pointofvue templates and call the {% vue %} tag with your VueContext to load VueJS and create an app.
<div id='app'>
The value of 'var1' is <b>${ var1 }</b>
</div>
{% load pointofvue %}
{% vue vue_ctx %}
Custom JavaScript
It is likely that you won't be able to get away with just writing HTML Vue alone, you may need to define methods and other JS native entities in custom JavaScript.
Note: pointofvue encourages you to not write inline JavaScript in your Django HTML templates. Write separate JS files and serve them via staticfiles instead
Define a Vue entry point that exports your Vue data. It may look like this:
import MyCustomComponent from './my-component.js';
const components = {
MyCustomComponent,
};
export {
components,
};
Build that JS file (target as a library if using vue-cli-service). Then register your script with the Python VueContext in your view:
vue_ctx.add_script('myscript')
Now you can use your custom component in your template:
<div id="app">
<b>My Custom Component</b>
<MyCustomComponent />
</div>
Development
Releasing
I use bump2version to manage version bumping. This will update the version number in the library, commit it, and create a version tag.
bump2version minor
git push --follow-tags
Metadata
Release files for pointofvue 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pointofvue-0.1.1.tar.gz | 4.4 kB | Without provenance | Details for pointofvue-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pointofvue-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for pointofvue-0.1.1-py3-none-any.whl |
Total release size: 10.1 kB
Release files / pointofvue-0.1.1.tar.gz
| Download URL | pointofvue-0.1.1.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ee87bb0154adff32317ac09e8d6700000c9e26127e486506c79e4958bd9d0bfc
|
|
BLAKE2b-256 checksum How to use checksums |
7b3ea96e1f6496e74a6c0228dfb4be7713a6c11066eadcaa2c0eca339fddf42a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Release files / pointofvue-0.1.1-py3-none-any.whl
| Download URL | pointofvue-0.1.1-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a9726ce577e56c293dacda3bb1de196b1df22ce6dfe6715caf508faa6ce0c1fd
|
|
BLAKE2b-256 checksum How to use checksums |
75bffcb3888a19967e1fb0ab67bdebeafde7f4a568de2837d8afe9f58ee6d4c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.11.5
|
Security for pointofvue 0.1.1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.