CovidZero / hummingbird-v2

Rest API to serve Covid-19 data
https://covidzero.com.br/contribuidores
Apache License 2.0
11 stars 14 forks source link
covid-19 covidzero flask python restful-api

Hummingbird V2

Python Tests Python Code Style Enforcement Auto Assign

Project Resources


Running out of docker container

- Setup dependencies


cd hummingbird-v2
virtualenv venv
source venv/bin/activate
pip install -r src/requirements.txt
pip install -r requirements_local.txt

- Setup database - using SQLite


export PYTHONPATH=$PYTHONPATH:$(pwd)/src
export FLASK_APP=src/main.py
export FLASK_ENV=local
flask db init --directory=local_migrations
flask db migrate --directory=local_migrations
flask db upgrade --directory=local_migrations   

- Running the application


export PYTHONPATH=$PYTHONPATH:$(pwd)/src
export FLASK_ENV=local
python src/main.py 

- Tests


export PYTHONPATH=$PYTHONPATH:$(pwd)/src
export FLASK_ENV=testing
python tests/runner.py

- Flake 8 For Style Guide Enforcement


flake8 src

- Database Seed


cd hummingbird-v2
export PYTHONPATH=$PYTHONPATH:$(pwd)/src
export FLASK_ENV=local
python src/main.py 
flask seed run

Running with docker container

- Setup your environment using docker


docker-compose build

- Start your environment using docker


docker-compose up

- Setup database for development


$ docker exec -it api /bin/bash

export PYTHONPATH=$PYTHONPATH:$(pwd)/src
export FLASK_APP=src/main.py
export FLASK_ENV=development
flask db init --directory=local_migrations
flask db migrate --directory=../local_migrations
flask db upgrade --directory=local_migrations  

Swagger API Doc