Deploying Django app's local postgres database to heroku? -
i unsuccesfully getting django app deployed on heroku use local postgres db.
my database settings follows:
databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'mydb', 'user': 'foo', 'password': 'bar', 'host': 'localhost', 'port': '', } }
everything runs fine locally. following instructions https://devcenter.heroku.com/articles/django, add following bit code bottom of 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, produces following error:
operationalerror @ / not connect server: connection refused server running on host "localhost" (127.0.0.1) , accepting tcp/ip connections on port 5432?
my django app runs fine on heroku, except when needs connect database, throws error.
anyone know doing wrong here?
- allow remote postgres access local db. example
- change settings file this:
databases = {
'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'your db name', 'user': 'your username', 'password': 'password', 'host': 'your computer's ip', 'port': '6122', }
or have clone local db heroku postgres , change settings use db.
Comments
Post a Comment