I am unsuccesfully getting my django app deployed on heroku to use my local postgres db.
My DATABASE settings are as follows:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'mydb',
'USER': 'foo',
'PASSWORD': 'bar',
'HOST': 'localhost',
'PORT': '',
}
}
Everything runs fine locally. Following the instructions from https://devcenter.heroku.com/articles/django, I add the following bit a code to the bottom of my settings file:
import dj_database_url
DATABASES = {'default': dj_database_url.config(default='postgres://foo:bar@localhost/mydb')}
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
However, this produces the following error:
OperationalError at / could not connect to server: Connection refused Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?
My django app runs fine on Heroku, except when it needs to connect to the database, which is where it throws this error.
Anyone know what I am doing wrong here?