Flask-VisJS
Flask-VisJS is a simple wrapper for the famous visjs java library. It helps you to integrate the library into your flask app.
Installation
pip install Flask-VisJS
Configuration
There are the following options available:
| Option | Default | Description |
|---|---|---|
| VISJS_CDN_TEMPLATE | https://cdnjs.cloudflare.com/ajax/libs/vis/{VERSION}/{FILENAME} | The CDN to use (only relevant if not localy served) |
| VISJS_JS_FILENAME | vis.min.js | The filename of the javascript file |
| VISJS_CSS_FILENAME | vis.min.css | The filename of the css file |
| VISJS_SERVE_LOCAL | True | If the files should be served localy or from a CDN |
| VISJS_CUSTOM_TEMPLATE_PATH | None | The path for a custom template (used by pyvis) |
| VISJS_VERSION | 4.21.0 (depends on the class) | The version of the visjs library |
Example
from flask import Flask, render_template_string
from flask_visjs import VisJS4, Network
app = Flask(__name__)
VisJS4().init_app(app)
@app.route('/')
def index():
net = Network('500px', '500px')
net.add_node(0, label="Node 0")
return render_template_string("""
<html>
<head>
{{ net.inject_css() }}
</head>
<body>
{{ net.inject_graph() }}
{{ net.inject_js() }}
</body>
</html>
""", net=net)
Release files for Flask-VisJS 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| Flask-VisJS-0.1.4.tar.gz | 184.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| Flask_VisJS-0.1.4-py2.py3-none-any.whl | Python 2, Python 3 | none | any | Details |
Total release size: 371.1 kB
Release files / Flask-VisJS-0.1.4.tar.gz
| Download URL | Flask-VisJS-0.1.4.tar.gz |
|---|---|
| Size | 184.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7e89fa23265b7b4a72c03908961f6d60e983b6d01b143da33c51596f8ba54276
|
|
BLAKE2b-256 checksum How to use checksums |
33ed0b2987b531fae32c1b6d421e0b2560f861b0d4bcbdc7809ea4e695200b23
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / Flask_VisJS-0.1.4-py2.py3-none-any.whl
| Download URL | Flask_VisJS-0.1.4-py2.py3-none-any.whl |
|---|---|
| Size | 186.2 kB |
| Tags | Python 2 Python 3 |
|
SHA-256 checksum How to use checksums |
bdd5a3917ed9913fd377aa0a78f3bad397bfe66a03d6265609bc6404a60a051f
|
|
BLAKE2b-256 checksum How to use checksums |
5dd1713515d8c2a95c9f4c8442a7746f75a82f64e64cd44b98f3c570cdd01bd6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|