[Answered ]-Django + Heroku Database

2👍

There’s no point having both of these. The last line of that snippet overwrites the default database config you defined previously.

Edit

This isn’t anything to do with whether or not you use manage.py runserver. The only point is that Heroku defines an environment variable, DATABASE_URL, which contains the database location and credentials, which is then parsed by dj_database_url. What you should be doing is defining the same thing locally: the dj_database_url docs have some examples of the format to use for different db backends.

The best way to set up the env variable is to put it in a file called .env in your development directory, and then always start your app via foreman start (Foreman should have been installed by the Heroku toolbelt). See the Heroku getting started docs for more.

But if this doesn’t work for you you can always just do export DATABASE_URL=whatever in your shell before you run manage.py for the first time.

Leave a comment