Postgresql can't connect application server through PGAdmin4

LucasPG picture LucasPG · Oct 17, 2016 · Viewed 61k times · Source

I installed PostgreSql on my Windows machine. I can connect to PostgreSql through cmd. But when I want to launch pgAdmin I am getting this error message.

Failed to connect to the pgAdmin application server. Click here to try again.

I have also Mysql installed on my machine if it can make any complications.

Answer

Sorin Călinică picture Sorin Călinică · Nov 2, 2016

The same problem happened to me today:

enter image description here

And this is how I've solved it:

1) Use a text editor to open the config_distro.py file under the c:\Program Files\pgAdmin 4\v1\web folder. Change the value for SERVER_MODE from True to False, then save the change. (I have run Notepad++ as an Administrator, in order to be able to save in this protected folder.)

enter image description here

2) Go to folder c:\Users\your_name\AppData\Roaming\pgAdmin and make sure there is nothing there (delete all the files, as they are temporary and will be restored after starting pgAdmin)

enter image description here

3) Start pgAdmin

enter image description here

4) This time you will see a white box that sits - at least, on my slow laptop - about 20 seconds. (You may briefly see the original error message, but do not worry).

enter image description here

5) Meanwhile, the temporary files - required for running the application - are created.

enter image description here

6) Once the temporary files process is over, the application starts as expected.

enter image description here