Changes to auto-provisioning of Heroku Postgres for Python apps

Change effective on 26 September 2022

When a new Python app is deployed to Heroku, the Python buildpack triggers the provisioning of a Heroku Postgres database addon in certain conditions, in order to improve the UX of deploying Django apps to the platform. This feature only applies to the first build of a new app, and not subsequent builds of existing apps.

Previously the criteria for provisioning the database was only that:

  • A manage.py file existed in the root of the app source or in any subdirectory up to three levels deep.

Now, the Heroku Postgres database is only provisioned if both of the following are true:

  • A manage.py file exists in the root of the app source (only).
  • Both the django and psycopg2 packages are installed.

This ensures the database is not provisioned in cases where the app uses an alternative database backend (such as MySQL), or does not use a database at all.

Apps that do not meet the new criteria but that still need a Postgres addon should either provision the addon manually, or if using Review Apps/Heroku CI the addon can be specified via app.json.