Deploy Flask on Light Cloud - a Python container on port 8000, served by Gunicorn bound to the routed port.
Deploy Flask
Flask is detected from your dependencies and runs as a Python container on port 8000. No Dockerfile needed - one is generated unless the repo has its own.
Serve it#
Run a production server, not flask run - bind 0.0.0.0 on the routed port:
gunicorn "app:create_app()" --bind 0.0.0.0:$PORT
(app:app for a module-level app object.)
Configuration and database#
Read environment variables at startup:
import os
app.config["SECRET_KEY"] = os.environ["SECRET_KEY"]
app.config["SQLALCHEMY_DATABASE_URI"] = os.environ["DATABASE_URL"]
DATABASE_URL comes from the Credentials tab; keep sslmode=require in place. Flask-Migrate/Alembic runs where the database is reachable - startup command or laptop.
Scaling#
Sync Flask workers hold a request each - lower concurrency (10-20) matches a small Gunicorn worker count better than the default 80. Scale to zero covers idle time.