Python - Flask - Mongo

Flask is a lightweight and flexible web framework written in Python that is used to build web applications. Flask is classified as a "microframework" because it provides essential tools for creating web applications, but does not impose a specific structure or components, giving developers great flexibility and freedom to choose the libraries and tools they want to use in their projects.

On the other hand, MongoDB is an open-source NoSQL database that is based on a flexible and scalable data model, known as BSON document storage. Instead of tables and rows as in relational databases, MongoDB stores data in JSON-like object documents, allowing for a more natural representation of complex data. It is highly scalable and can handle large volumes of data, distributing the load across clusters and providing replication for high availability. MongoDB is widely used in web applications, mobile apps, and projects that require rapid iteration in development and agile storage of unstructured or semi-structured data.

Project Structure

.
├── compose.yaml
├── app.Dockerfile
├── app
    ├── requirements.txt
    └── server.py

Application Deployment

cd stack/python/flask-mongo
docker compose up -d

Check container status

$ docker compose ps

Stop and remove the container

$ docker compose down

Troubleshooting:

Last updated