ML-Dashboard is a Flask application that provides scalable and beautiful plotting and interaction.
ML-Dashboard is built on the following technologies:
- Docker : to simplify deployment
- Nginx : high-performance reverse proxy to speed up web page serving
- uWSGI : a fast and light-weight WSGI server
- Flask : a python microframework that makes web app development fun
- Node.js : enable common front-end tools, like those below
- Gulp : automation toolkit to streamline management of web assets
- Material-Design-Lite : adds Material Design look and feel to pages
- Material-Design-Icons : adds library of icons customized for Material Design
- Plotly.js : make beautiful charts easily
- Clone the repo
# git the repo
git clone https://github.com/gramhagen/ml-dashboard
cd ml-dashboard
Install the applicaiton
- Using Docker
# build the container docker build -t ml-dashboard deploy # run the container ENV can be [<dev>, test, prod], expose ports 80 and 9001 docker run -e "ENV=prod" -p 80:80 -p 9001:9001 -it ml-dashboard
Local Installation (the following directories must be installed, or config files should be modified)
- /usr/local/virtualenvs : to house python virtual environments
- /usr/local/ml-dashboard : where the source code is
- /var/run/ml-dashboard : where the uwsgi pid and socket files go
- /var/log/ml-dashboard : where all logs are written
# create ml-dashboard virtualenv mkvirtualenv /usr/local/virtualenvs/ml-dashboard pip install --upgrade pip pip install -r requirements.txt python manage.py init # assuming node is installed # install node packages and build web assets cd application npm install npm run build # using nginx shouldn't be necessary for local development
The application is configured via files in the config folder. The flask.tmp file can be modified with database authentication information, but otherwise the files do not need to be adjusted unless you intend to tweak params or change directories used.
- flask.tmp : template file for flask configuration, customize logging and database authentication
- nginx.conf : nginx configuration file
- supervisor.conf : supervisor configuration file, controls execution of uwsgi and nginx
- uwsgi.ini : controls uwsgi execution
- uwsgi_params : params used to coordinate between uwsgi and nginx
Run the application locally just with flask:
# from root dir, using appropriate venv
python manage.py runserver
Run the application locally with uwsgi
# from root dir, using appropriate venv, ENV can bd [<dev>, test, prod]
# you may need to create pid and log folders with correct permissions (/var/run/uwsgi, /var/log/ml-dashboard)
uwsgi --ini config/uwsgi.ini --http-socket 0.0.0.0:80 --env ENV='dev'
General management tasks have been consolidated into the manage.py module using Flask-Script.
# from root dir, using appropriate venv
# get help info
python manage.py
The following options are available:
- lint : use pylint to lint all python files
- test : use pytest to test run all tests in tests dir
- build_docs : build docs automatically from docstrings in code
- publish_docs : publish doc .rst files to html
- init : creates secret key for Flask and imports flask configuration template into instance folder
- runserver : run the server locally just using Flask's built in server, use -? for more options
- clean : clean up autogenerated files (useful prior to git commits or deployments)
- archive : archive files for deployment, puts them in project.zip folder under deploy folder