This article will teach you how to deploy your Flask (opens in a new tab) project on Zeabur.
Step1: Create Flask Project
You can get the example project from flask-template (opens in a new tab). The Flask example is quite simple. It has a single route that returns a string.
from flask import Flask import os app = Flask(__name__) @app.route('/') def index(): return "Welcome, this is a Flask app deployed on Zeabur" if __name__ == '__main__': app.run(debug=True, port=os.getenv("PORT", default=5000), host='0.0.0.0')
Please note that Zeabur uses environment variable
PORT to determine which port to forward. You will therefore need to set this environment variable and use
os.getenv or other ways to configure the port number in your application.
python app.py or
python main.py to run Python App. So Your project should contain one of these files and include the commands needed to run the Flask application.
Zeabur determines which ports to open based on the environment variable
Click on Add new service button, then choose Deploy your source code.
Search for your Flask App repository, click on import, your Flask App will start deploying.