A simple flask wrapper for the famous visjs library.
Project description
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)
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
Flask-VisJS-0.1.3.tar.gz
(184.8 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file Flask-VisJS-0.1.3.tar.gz.
File metadata
- Download URL: Flask-VisJS-0.1.3.tar.gz
- Upload date:
- Size: 184.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c5419b1e14ad55f261a1993bd6a59fb52956c8833ae3273eedf48f9abee25a4
|
|
| MD5 |
3c20d98cd69dfbf99a3d0d0352aedff0
|
|
| BLAKE2b-256 |
41f0bd09e8918926e60ddc63c72c87567e4e38fb7168ecde0a5dfc8d24098740
|
File details
Details for the file Flask_VisJS-0.1.3-py2.py3-none-any.whl.
File metadata
- Download URL: Flask_VisJS-0.1.3-py2.py3-none-any.whl
- Upload date:
- Size: 186.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
57c0fa86e8467072fe81e7d5d89f240a5146b37bf63d8d59205c3f2d0edd5fd4
|
|
| MD5 |
5a8c3f199cd1ba497c0261ca104744b4
|
|
| BLAKE2b-256 |
128376d8de575d781853db5a1214ffd67804e4f0dd0fe49ac58750e9236facd1
|