Python - Flask - MySQL

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 the 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, MySQL is a widely used open-source relational database management system that allows for efficient storage, organization, and retrieval of data. Developed by Oracle, MySQL offers high speed and reliability, making data management easier through SQL queries. Its scalability, support for multiple platforms, and ability to integrate with numerous programming languages make it a popular choice for web and enterprise applications. MySQL is highly customizable and has an active community of developers contributing to its continuous improvement.

Project Structure

.
├── compose.yaml
├── app.Dockerfile
├── db
    ├── password.txt
├── app
    ├── requirements.txt
    └── hello.py

Don't forget to change the password in the password.txt file before starting the containers for the first time.

Application Deployment

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

Check container status

$ docker compose ps

Stop and remove the container

$ docker compose down

Troubleshooting:

Last updated