In this project, I builded a movie tracking API from scratch using Python with FastAPI and MongoDB. During the project, I learned the basics of web application development, how to structure a Python project, how to apply design patterns and write unit tests for the API. I also learned how to use the tools that professional Python developers use in their daily work and improve my workflow.
- Format the project files
make format
- Generate the project documentation
make generate-docs
- Run the project unit tests
make tests
- Run the application using Dockerfile
docker run mongo:5.0.14
docker build . -t movie-tracker
docker run -p 8000:8000 movie-tracker
- Run the application using Docker-compose
docker-compose up
microk8s enable registry metrics-server dns storage
docker tag movie-tracker:latest localhost:32000/movie-tracker
docker push localhost:32000/movie-tracker
kubectl apply -f movie_tracker_deployment.yaml
kubectl get services
- install Gunicorn
# Run the app with the default UvicornWorker and one worker
gunicorn -k uvicorn.workers.UvicornWorker main:create_app
# Run the app with the MyUvicornWorker and two worker
gunicorn -k api.workers.MyUvicornWorker -w 2 main:create_app