steve-kasica / d3-flask-playground

simple experiment visualizing python generated data in D3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

d3-flask-playground

simple experiment visualizing python generated data in D3

Setup with Docker Compose

If you have Docker Compose installed on your machine, you can quickly setup the backend and frontend in development mode, as described below, with one command:

$ docker-compose up

Then, navigate your browser to localhost:8080.

Backend Setup (Python, Flask)

On Windows, activate virtual environment with source venv/Scripts/activate.

python3.8 -m venv venv
source venv/bin/activate
pip install Flask Flask-Cors
pip install waitress
pip install numpy

Code from https://testdriven.io/blog/developing-a-single-page-app-with-flask-and-vuejs/

Use waitress as a production WSGI server.

Start:

  • development server: FLASK_ENV=development FLASK_APP=app:app flask run
  • production server: waitress-serve --port=5000 app:app
  • browse to http://127.0.0.1:5000/data/12

Frontend Setup (TypeScript, D3)

Steps to run:

  • Setup dependencies yarn install
  • (optionally) change BACKEND_URL in src/chart.ts
  • Start development server npm start and browse to http://localhost:8080/
  • Build for production server npm run build and copy dist folder

Further ToDos

About

simple experiment visualizing python generated data in D3

License:MIT License


Languages

Language:TypeScript 45.9%Language:Dockerfile 20.7%Language:JavaScript 18.1%Language:Python 15.2%