The Next Generation Platform is Coming - Get Ready Now!
by heroku
GitHub Readme.md
This is the official Heroku buildpack for Python apps.
Recommended web frameworks include Django and Flask, among others. The recommended webserver is Gunicorn. There are no restrictions around what software can be used (as long as it's pip-installable). Web processes must bind to $PORT
, and only the HTTP protocol is permitted for incoming connections.
See the Getting Started on Heroku with Python tutorial.
A requirements.txt
, Pipfile
or poetry.lock
file must be present in the root (top-level) directory of your app's source code.
We recommend that you specify a Python version for your app rather than relying on the buildpack's default Python version.
For example, to request the latest patch release of Python 3.13, create a .python-version
file in
the root directory of your app containing:
3.13
The buildpack will look for a Python version in the following places (in descending order of precedence):
runtime.txt
file (deprecated).python-version
file (recommended)python_full_version
field in the Pipfile.lock
filepython_version
field in the Pipfile.lock
fileIf none of those are found, the buildpack will use a default Python version for the first build of an app, and then subsequent builds of that app will be pinned to that version unless the build cache is cleared or you request a different version.
The current default Python version is: 3.13
The supported Python versions are:
These Python versions are deprecated on Heroku:
Python versions older than those listed above are no longer supported, since they have reached end-of-life upstream.
For more information about using Python on Heroku, see Dev Center.
Copy the snippet above into CLI.