This project is built/tested with the following stack:
Other versions may work, but at your own risk. Caveat emptor.
npm install # Install JavaScript dependencies
npm run build # Compile and minify JavaScript for production
python3 -m venv ./env # Initialize Python virtual environment
. env/bin/activate # Activate virtualenv in current shell
pip install -r requirements.txt # Install Python dependencies
python server/server.py # Run Flask server
To view the webapp, visit http://0.0.0.0:8869 in your web browser.
N.B.; if you try to run the Python server without building the JavaScript first, you'll encounter a jinja2.exceptions.TemplateNotFound
error. Just run npm run build
and try again.
After setting up your Python and JavaScripts environments as described above, you can run tests as follows:
# Server tests
. env/bin/activate # Still in virtualenv, from above instructions
python server/test_server.py # Run tests
coverage run --source=server server/test_server.py # Run server tests with Coverage
coverage html # Generate Coverage report (run above command first)
open htmlcov/index.html # Open Coverage HTML report on MacOS
# Frontend tests
npm run test:unit # Run tests
open coverage/lcov-report/index.html # Open Coverage HTML report on MacOS
-
This setup shouldn't be used in production as-is; ideally it should be run behind a proper web server (such as Gunicorn) and a reverse proxy (such as NGINX).
-
NGINX also would make it possible to enable gzip compression, which hypothetically would speed up response times quite a bit for larger responses.
npm install # Installs JavaScript dependencies
npm run serve # Compiles and hot-reloads for development
npm run build # Compiles and minifies for production
npm run lint # Lints and fixes files