Python

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

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 --no-dev
  • 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 .

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, or a simple HTTP server

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