Python

Requirements

Notes

Define a Procfile

Use a Procfile to explicitly declare what command should be executed to start your app.

The Procfile in the example app you deployed looks like this:

web: gunicorn myproject.wsgi --log-file -

Declare dependencies

Backery recognizes an app as a Python app by looking for key files, like requirements.txt.

A requirements.txt looks something like this:

django
gunicorn
django-heroku

When an app is deployed, Backery reads this file and installs the appropriate Python dependencies using the pip install -r command.

To do install dependencies locally, you can run the following command:

pip install -r requirements.txt

Production example

1. Add the Procfile to the root of your app

Example

web: gunicorn myproject.wsgi --log-file -

2. Install Gunicorn, freeze requirements

pip install gunicorn
pip freeze > requirements.txt

Note: any other dependencies should also be listed in requirements.txt before you freeze it.

3. Specify a Python version (optional)

Newly created Python applications default to the Python 2.7 runtime (to see the current default version, refer to the Python buildpack).

If you need to specify a different vesion, create a file named runtime.txt and add it to the root of your git project, and list the python version.

Supported Python Versions