Example of FastAPI with pytests.
- Create a virtual env:
python3.8 -m venv .venv - Activate it:
source .venv/bin/activate - Install depenencies:
pip install -r requirements.txt -r requirements-dev.txt - Run:
pytest tests/
- Create a virtual env:
python3.8 -m venv .venv - Activate it:
source .venv/bin/activate - Install depenencies:
pip install -r requirements.txt -r requirements-dev.txt - Run:
python app.py - Check: http://127.0.0.1:8000/hello-world
- Build the image locally:
docker build -t example:local --load . - Run exposing the ports:
docker run -p 8000:8000 example:local