Documentation menu

Deploy any Python app on Light Cloud - the runtime behind Django, FastAPI, and Flask, run as a container on port 8000.

Deploy Python

Any Python web app runs as a container on the Python runtime - the same machinery behind the Django, FastAPI, and Flask guides, available to every other Python server too. Detection reads your dependency manifest; the default port is 8000.

The contract#

  • Bind 0.0.0.0, not 127.0.0.1 - traffic is routed into the container from outside.
  • Listen on the routed port, or read PORT from the environment, which is set to it.
  • Log to stdout/stderr - that is what lands in runtime logs.
uvicorn app:app --host 0.0.0.0 --port $PORT     # ASGI
gunicorn app:app --bind 0.0.0.0:$PORT           # WSGI

Configuration and database#

Containers receive environment variables at runtime - read os.environ at startup, never at image build. DATABASE_URL comes from the Credentials tab; SQLAlchemy and most drivers take it directly.

Scale to zero and workers#

Python containers scale to zero like any other. Keep startup light, connect to the database lazily, and match concurrency to your server model - high for async, 10-20 for sync workers or CPU-heavy endpoints.