Heroku Python Support

Last Updated: 19 March 2014

cedar django python

Table of Contents

This document describes the general behavior of the Heroku Cedar stack as it relates to the recognition and execution of Python applications. For framework specific tutorials please see:

If you have questions about Python on Heroku, consider discussing it in the Python on Heroku forums. Both Heroku and community-based Python experts are available.

General support

The following support is provided, irrespective of the type of Python application deployed.

Activation

The Heroku Python Support will be applied to applications only when the application has a requirements.txt in the root directory. Even if an application has no module dependencies, it should include an empty requirements.txt to document that your app has no dependencies.

Runtimes

By default, we run 64bit CPython 2.7.6.

Optionally, we support arbitrary versions of Python. This functionality is enabled by the presence of a runtime.txt file.

$ cat runtime.txt
python-2.7.6

See Specifying a Python Runtime for more details.

Libraries

The following libraries are used by the platform for managing and running Python applications and cannot be specified.

  • Setuptools 2.1: Python packaging tools.
  • Pip 1.5.4: Application dependency resolution.

Build behavior

The following command is run on your app to resolve dependencies:

$ pip install -r requirements.txt --allow-all-external

The .heroku directory is cached between pushes to speed up package installation.

Python applications

Pure Python applications, such as headless processes and evented web frameworks like Twisted, are fully supported on Cedar.

Activation

When a deployed application is recognized as a pure Python application, Heroku responds with -----> Python app detected.

$ git push heroku master
-----> Python app detected

Add-ons

No add-ons are automatically provisioned if a pure Python application is detected. If you need a SQL database for your app, add one explicitly:

$ heroku addons:add heroku-postgresql:dev

Process types

No default web process types created if a Python application is detected.

Django applications

All versions of Django are fully supported on Cedar. Django applications are detected by the presence of a manage.py file within the repository.

Add-ons

A dev database add-on is provisioned automatically for Django applications. This populates the DATABASE_URL environment variable.