[Fixed]-How to set up database for Django app on Heroku?

23👍

You can do it manually by looking at your database info in the dashboard or by running "heroku config" to see the DB configuration string. But the best way by far is as detailed in the Heroku Getting Started guide for Django. Add dj-database-url==0.2.1 to your requirements.txt file and then:

# Parse database configuration from $DATABASE_URL
import dj_database_url
DATABASES = {
    'default': dj_database_url.config()
}

in lieu of other database definitions.

Leave a comment