jac300
jac300

Reputation: 5222

PostgreSQL psql: could not connect to server: Connection refused

I am making my first Django app and am trying to deploy to Heroku. I am using a postgres database. My app works fine when I run it on localhost. I pushed my project to Heroku and when I attempt to go to the site I get the following error:

"psql: could not connect to server: Connection refused Is the server running on host  
host.domain.com and accepting TCP/IP connections on port 5432?"

So I have been searching endlessly to the solution for this problem, and of the few I have found, NONE can explain clearly the steps involved in changing the postgres settings from localhost. Apparently I am supposed to change a setting in a postgres config file that I cannot find any trace of on my computer, and I can't find command line instructions either. Even the postgres docs don't help.

Can anyone help me to solve this?

Upvotes: 2

Views: 3444

Answers (1)

Erwin Brandstetter
Erwin Brandstetter

Reputation: 656716

Since you pushed your project to Heroku, changing files for your local Postgres installation is irrelevant to the problem.

The question is: Does the remote Postgres installation on Heroku allow remote access? And if yes, what are the exact credentials? For starters, I doubt you can use the standard port 5432. And you may need sslmode=require.

Consult Heroku for the actual credentials. This site may help:
https://devcenter.heroku.com/articles/heroku-postgresql#external-connections-ingress

Upvotes: 2

Related Questions