This repository is to practice FastAPI code while learning it
https://fastapi-learning.onrender.com/
Python Version: 3.11.1
-
Create Virtual env
python3 -m venv venv
-
Install Packages
pip install -r requirements.txt
-
Add these environment variables in .env file or in shell
export MONGO_URI=mongodb://172.17.0.2:27017 export PYTHONPATH=$PYTHONPATH:$PWD export APP_HOST=0.0.0.0 export APP_PORT=8000
-
Install MongoDB or use MongoDB Docker Image (https://hub.docker.com/_/mongo)
python3 main.py
If you prefer to use docker container, or need to debug the build for some reason, you can follow these chain of commands:
-
Build the Docker Image
docker build . -t fastapi-learning:v1 -f deploy/Dockerfile
-
Create and Run Docker container
docker run -d --net=host fastapi-learning:v1
bash scripts/lint.sh