Python

Detected from requirements.txt, Pipfile, or pyproject.toml.

Step-by-step deploy guides: Python, Django, Flask, FastAPI, Streamlit.

See Buildpacksfor how detection and version policy work.

Detects

requirements.txt, Pipfile, or pyproject.toml in the base directory.

Versions

Default is Python 3.13. Published lines as of September 2026: 3.10-3.14. You get the latest patch of the requested minor.

Pin, in this order:

  • .python-version
  • runtime.txt (python-3.12 is fine)
  • requires-python in pyproject.toml (a range picks the highest matching published version)

Install and build

  • poetry.lock: Poetry, poetry install --only main
  • Pipfile.lock: Pipenv, pipenv install --deploy --system
  • requirements.txt: pip install -r requirements.txt
  • pyproject.toml with [tool.poetry] and no lockfile: Poetry
  • Otherwise: pip install .

The builder installs pip, Poetry and Pipenv at pinned versions that run on every supported Python version. We bump them regularly; deploying without cache gets your app the current ones.

Django apps (manage.py plus a Django dependency) run collectstatic --noinput. A failure there is logged and does not fail the build.

Launch sets PYTHONUNBUFFERED=1. Django also gets DJANGO_ENV=production and, when a */wsgi.py file exists, DJANGO_SETTINGS_MODULE.

Start command

  • Django: gunicorn <dir>.wsgi --bind 0.0.0.0:$PORT --workers 3
  • FastAPI / Starlette: uvicorn main:app --host 0.0.0.0 --port $PORT (or app:app if that file holds the app)
  • Flask: Gunicorn on app:app, application:app, or wsgi:app
  • Otherwise python app.py or python main.py

Put gunicorn or uvicorn in your dependencies if you rely on those defaults. Override with a Procfile. Listen on PORT.

If none of these match, the Procfile has to define the processes: at least one valid line other than release:, for example web: or worker:. Otherwise the build fails with an error instead of serving the app directory. A worker-only app (a bot, for example) without a web: line needs its own process: on the Processes tab, create a process named like the Procfile entry (for example worker, without a port) and set the web process to 0 instances.

Give your agent a cloud.

Earn up to 15 € in credit when signing up.

Continue with GitHub

or with email

Stay in the loop.

Product news, no spam. Unsubscribe anytime.