0

Cloned a previous Python Flask app and deployed on Heroku but its displaying 'Internal Server Error' and when checked logs it says

sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) 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?
Sia
  • 47
  • 1
  • 1
  • 9
  • 1
    Are you sure that the PostgreSQL database connection credentials are correct? – PROTOCOL Mar 12 '19 at 10:52
  • Yes, they are correct. – Sia Mar 12 '19 at 11:00
  • Have you tried testing with the wrong password to see if you get different error message? Next stage is to ensure server is listening e.g. for me it's the cmd (windows) `netstat -ant | findstr 5432` – Andrew Allen Mar 12 '19 at 16:42
  • A snippet of the code that configures the connection would be helpful, too. If you are using Heroku's `DATABASE_URL` variable to get the connection string, remember that you may get a non-standard port, so you'll need to make sure all options (host, port, database) are read. – bimsapi Mar 13 '19 at 18:05
  • @AndrewAllen when looked up for that port...there are 3 processes running – Sia Mar 16 '19 at 04:13
  • App is working on local. But why Heroku is unable to detect that server is already running. – Sia Mar 16 '19 at 05:18
  • Working now with heroku db..... Config variable was incorrect – Sia Mar 17 '19 at 05:19

0 Answers0