An demonstration of data-visualization web app with basic dashboard UI
This example is built upon Gui Talarico's Flask-Vuejs-Template with additional inspirations from these following online resources:
- Flask backend with Flask-RestPlus API
- Altair plotting and Vega spec json object serving from backend
- Vega and Vega-Embed for plot rendering at frontend
- vue-cli 3 + yarn
- Vuex state management
- Vue Router
- Vuetify material design for dashboard UI
- Axios for backend communication
- Heroku Configuration with one-click deployment + Gunicorn
The details on the directory structure and usage can be found in the README.md
file of Gui Talarico's repo. For reader's convenience, here I will only copy and paste the key files and some basic installation instructions below.
Location | Content |
---|---|
/app |
Flask Application |
/app/api |
Flask Rest Api (/api ) |
/app/client.py |
Flask Client (/ ) |
/src |
Vue App . |
/src/main.js |
JS Application Entry Point |
/public/index.html |
Html Application Entry Point (/ ) |
/public/static |
Static Assets |
/dist/ |
Bundled Assets Output (generated at yarn build |
Before getting started, you should have the following installed and running:
- Yarn - instructions
- Vue Cli 3 - instructions
- Python 3
- Pipenv (optional)
- Heroku Cli (if deploying to Heroku)
-
Clone this repository:
$ git clone [email protected]:xujiboy/flask-vega-vuejs-vuetify-example.git
-
Setup virtual environment, install dependencies, and activate it:
$ pipenv install --dev $ pipenv shell
-
Install JS dependencies
$ yarn install
Run Flask Api development server:
$ python run.py
From another tab in the same directory, start the webpack dev server:
$ yarn serve
The Vuejs application will be served from localhost:8080
and the Flask Api
and static files will be served from localhost:5000
.
The dual dev-server setup allows you to take advantage of webpack's development server with hot module replacement.
Proxy config in vue.config.js
is used to route the requests
back to Flask's Api on port 5000.
If you would rather run a single dev server, you can run Flask's
development server only on :5000
, but you have to build build the Vue app first
and the page will not reload on changes.
$ yarn build
$ python run.py
Please refer to the README.md
file of Gui Talarico's repo.