Build a CRUD Rest API in Python using Flask, Postgres, Docker and Docker compose #python #docker
Table of Contents
Title: Build a CRUD Rest API in Python using Flask, Postgres, Docker and Docker compose
Channel: Francesco Ciulla
Description: In this tutorial, we will create a set of CRUD Rest API using Flask, SQLAlchemy with Postgres as a Database, Docker, and Docker Compose.
Step-by-Step Tutorial:
-
Setting up the Project:
- Start by setting up the project architecture and dependencies in the
requirements.txt
file.
- Start by setting up the project architecture and dependencies in the
-
Creating the Flask App:
- In the
app.py
file, create a Flask app, SQLAlchemy app, model, and a test route.
- In the
-
Implementing Routes and CRUD Controllers:
- Develop routes and CRUD controllers for Create, Read, Update, and Delete functionalities.
-
Dockerizing the Flask Application:
- Create a
Dockerfile
to dockerize the Flask application.
- Create a
-
Configuring docker-compose.yml:
- Set up the
docker-compose.yml
file with Flask app and Postgres services.
- Set up the
-
Testing Postgres Container:
- Verify the Postgres container by testing it with tools like Tableplus.
-
Building and Running the Application:
- Build the Docker image for debugging and run the app service. Test the endpoints to ensure everything works correctly.
-
Bug Fixing and Final Testing:
- Address any bugs that may arise and perform a final test to validate the functionality of the CRUD Rest API.
By following these steps, you will be able to create a fully functional CRUD Rest API in Python using Flask, Postgres, Docker, and Docker Compose. For more detailed information, you can refer to the article and code provided in the description of the video.