python >= 3.6 pip >= 18.x virtualenv >= 16.0.0
brew install python3
brew install pip3
brew install virtualenv
To setup virtual environment, from within project directory:
virtualenv virt
source virt/bin/activate
To deactivate virtual env any time:
deactivate
Install dependencies with virtual environment
pip install Flask flask_sqlalchemy flask_marshmallow marshmallow-sqlalchemy trueskill
To create the new database structure and import the games recorded from the score cards:
FLASK_ENV=dev python import.py --reset
Note: If you don't specify --reset
, the db will not be reset and all games in the script will be added
To get the teams rankings in nice text formatted output:
FLASK_ENV=dev python rankings.py
FLASK_ENV=dev python application.py
You can then access in browser or postman via endpoints:
To be able to deploy to AWS Elastic Beanstalk, you need to install EB CLI described here: https://docs.aws.amazon.com/elasticbeanstalk/latest/dg/eb-cli3-install.html
pip install awsebcli --upgrade --user
You will then need to initialise eb deployment:
eb init
Then for any changes to app we simply run
eb deploy
To initially import all the games for the first time, ssh into aws eb env:
eb ssh
sudo su
cd /opt/python/current/app
source /opt/python/run/venv/bin/activate
python import.py --reset
And to open base url in browser:
eb open
Currently base url on EB env is: