Standard Flask project API and Database using tools and best practices.
- Python 3.6
- Flask
- SQLAlchemy
- Marshmallow
- Dynaconf
- Blueprint
- Gunicorn
- Pipenv
- Docker
- Docker-Compose
- Gelf Logger
- Flake8
- Sentry
- Prometheus
- Swagger
- Unit-Tests
- Integration-Tests
To run this project locally, you need to install pyenv and pipenv in order to create the Python virtual environments This project use Python 3.6
If you don't have python 3.6 installed, run
pyenv install 3.6.9Pipenv will use python 3.6.9 just instaled
make installTo activate this project's virtualenv, run pipenv shell.
make shellJust run the command
make run/docker-composeJust run the command
make run/docker-compose-structureBefore, check if mysql is running correctly
docker psJust run the command
make run/localBefore, check if mysql is running correctly
docker psJust run the command
make run/dockerJust run the command
make lintJust run the command
make testJust run the command
make run/docker-compose-structure
make test/integrationTo learn more about Docker Swarm, visit https://prometheus.io This project is configured to run with docker swarm. First configure docker swarm Create Docker Swarm node
docker swarm init --advertise-addr [your-localhost-ip-v4]Create and initialize stack
docker stack deploy --compose-file="docker-compose.yml" py-apiDocker Swarm configuration is defined in deploy configuration in docker-compose.yml file
Just run the command
find . -type f -exec sed -i "s/py-api/yourprojectname/g" {} +To learn more about Prometheus, visit https://prometheus.io To access local metrics, access: http://localhost:5000/metrics Or http://your-ipv4-ip:5000/metrics
To learn more about Sentry, visit https://sentry.io Create a free Sentry account Passing as application arguments the Sentry DSN
export SENTRY_DSN=YOUR-SENTRY-DSNJust don't commit directly on master, push a branch and Pull Request.