Python - Flask + MySQL
Flask is a lightweight and flexible web framework written in Python used to build web applications. Flask is classified as a โmicroframeworkโ, because it provides the essential tools to create 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 storing, organizing, and retrieving data efficiently. Developed by Oracle, MySQL offers high speed and reliability, facilitating data management 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
.
โโโ app
โย ย โโโ hello.py
โย ย โโโ requirements.txt
โโโ app.Dockerfile
โโโ compose.yaml
โโโ nginx
โย ย โโโ default.conf
โโโ backup
โย ย โโโ backup-runner.sh
โโโ .env
โโโ .env.example
Application deployment:
Change to the directory that contains the files necessary to build the container:
cd /root/stack/python/flask-mysql
Then start the application:
docker compose up -d
Useful commands:
View the running containers:
docker compose ps
Stop and remove the application:
docker compose down
Rebuild the application after making changes to the code:
docker compose up -d --build