1👍
Your database must be created on Heroku. Run this command in Git (or your Heroku client)-
$heroku addons:add heroku-postgresql
This creates an empty PostGRES database on Heroku.
Next, your settings on the deployed site must reflect the database. The dj_database_url that is part of the heroku_toolbelt python module will automatically query Heroku to get the live database settings. Make these changes to your Django site (the cling module is also part of the Heroku Toolbelt).
settings.py
import dj_database_url
DATABASES['default'] = dj_database_url.config()
wsgi.py
from django.core.wsgi import get_wsgi_application
from dj_static import Cling
application = Cling(get_wsgi_application())
Finally, you must actually sync the Django models to the database (with a database provisioned on Heroku and your Django project settings pointing to the database). This is also done through Git-
heroku run python manage.py syncdb
In fact, any Django terminal commands can be run in this matter (for example, running a South migration on your Heroku DB can done with run python manage.py migrate app_name
).
For more info, read here – https://devcenter.heroku.com/articles/getting-started-with-django