I\'m here because I\'m really really new with heroku-python-django-postgresql group. I have googled for a usage for dj-database-url and I don\'t understand why i have to use it
Use pip module dj-dtabase-url. Add an environmental var with the name 'DATABASE_URL' and the value from the heroku db settings.
Important, to avoid the error 'NameError: name 'DATABASES' is not defined.' You still have to leave for example the default DATABSE settings.
The complete code:
import dj_database_url
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': 'mydatabase',
}
}
DATABASES['default'] = dj_database_url.config()
dj-database-url is a utility to help you load your database into your dictionary from the DATABASE_URL environment variable. Heroku uses environment variables for your database and other addons. To begin using your database you'd simply use the below command to setup your DATABASES dictionary:
import dj_database_url
DATABASES['default'] = dj_database_url.config()
And maybe stash DATABASE_URL in your virtualenv activate script.