Deploy Flask

Leash detects Python apps by the presence of requirements.txt. Flask apps are auto-detected and served with gunicorn.

Detection

If your requirements.txt includes flask, Leash picks the Flask build strategy and uses gunicorn as the production server.

Example App

app.py
from flask import Flask, jsonify
app = Flask(__name__)
@app.route("/")
def index():
return "<h1>Hello from Leash!</h1>"
@app.route("/api/health")
def health():
return jsonify({"status": "ok"})
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8080)

Dependencies

requirements.txt
flask
gunicorn

Tip

Include gunicorn in your requirements.txt. Leash uses it as the production server automatically.

Deploy

Terminal

$ leash deploy

✓ Detected Flask (Python)

✓ Image built and pushed

✓ Deployed successfully!

→ https://my-flask-app-arvin.un.leash.build