$ ls Procfile requirements.txt web.py $ heroku create --buildpack git://github.com/heroku/heroku-buildpack-python.git $ git push heroku master ... -----> Python app detected -----> Installing runtime (python-2.7.8) -----> Installing dependencies using pip Downloading/unpacking requests (from -r requirements.txt (line 1)) Installing collected packages: requests Successfully installed requests Cleaning up... -----> Discovering process types Procfile declares types -> (none)
You can also add it to upcoming builds of an existing application:
$ heroku config:add BUILDPACK_URL=git://github.com/heroku/heroku-buildpack-python.git
The buildpack will detect your app as Python if it has the file
requirements.txt in the root.
It will use Pip to install your dependencies, vendoring a copy of the Python runtime into your slug.
You can also provide arbitrary releases Python with a
$ cat runtime.txt python-3.4.2
Runtime options include:
Other unsupported runtimes are available as well.
If you need to install dependencies stored in private repositories, but you don't want to hardcode passwords in the code, you can use the following approach.
Generate or use an existing a new SSH key pair (https://help.github.com/articles/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent/)
For this example, assume that you named the key
Add the public ssh key to your private repository account.
Add CUSTOM_SSH_KEY and CUSTOM_SSH_KEY_HOSTS environment variables to you heroku app
# OSX $ heroku config:set CUSTOM_SSH_KEY=$(base64 --input ~/.ssh/deploy_key.pub) CUSTOM_SSH_KEY_HOSTS=bitbucket.org,github.com # Linux $ heroku config:set CUSTOM_SSH_KEY=$(base64 ~/.ssh/deploy_key.pub | tr -d '\n') CUSTOM_SSH_KEY_HOSTS=bitbucket.org,github.com
Deploy your app and enjoy!
Copy the snippet above into CLI.