Python Database Auto-Provisioning
Last updated December 03, 2024
A Heroku Postgres database automatically provisions by default for Python apps if certain conditions are met. This article covers how this works and how to opt out of this behavior.
This page isn’t applicable Fir-generation apps.
This page is only applicable to accounts created before May 15, 2023 or if you asked Heroku Support to enable auto-provisioning for your account.
Database Auto-Provisioning
The Python buildpack automatically provisions a Heroku Postgres database on the first deploy of your app if:
- You created your account before May 15, 2023 or if you asked Heroku Support to enable auto-provisioning for your account
- A
manage.py
file exists in the root of the app source - Both the
Django
andpsycopg2
packages are installed
Automatic provisioning of a database also populates your app’s DATABASE_URL
config var.
A Heroku Postgres database is not automatically provisioned for other Python apps, but you can provision one manually.
Toggle Auto-Provisioning a Database
You can add or remove this feature by opening a ticket with Heroku Support. To learn more, see How do I toggle auto-provisioning of a database on first deployment?.