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

Expose a module-level app — gunicorn picks it up automatically. Don't call app.run(): that's the Flask dev server, not used in production.

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"})

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-your-org.un.leash.build