This is a sample of a basic Flask TODO app. The items are stored in memory and are lost when the server is restarted, but it should give you a basic idea of how to get started with Flask on Defang. Note that alognside your .py file, include a requirements.txt so that the Dockerfile can install the necessary packages with pip.
This sample is a simple Flask app that demonstrates how to create a TODO app using Flask. The items are stored in memory and are lost when the server is restarted. This sample is intended to provide a basic understanding of how to get started with Flask on Defang. it is not intended for production use. If you need something production ready, you should use a managed database like Postgres or MySQL.
- A Dockerfile.
- A compose file to define and run multi-container Docker applications (this is how Defang identifies services to be deployed).
- A .dockerignore to ignore files that are not needed in the Docker image or will be generated during the build process.
- Download Defang CLI
- If you are using Defang BYOC, make sure you have properly authenticated your AWS account (optional)
- Open the terminal and type
defang login
- Type
defang compose up
in the CLI - Your app should be up and running with Defang in minutes!
Title: Simple Flask App
Short Description: A basic Flask todo app.
Tags: flask, python
Languages: python