windows Postgresql 无法通过 PGAdmin4 连接应用服务器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/40083391/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Postgresql can't connect application server through PGAdmin4
提问by LucasPG
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.
我在 Windows 机器上安装了 PostgreSql。我可以通过 cmd 连接到 PostgreSql。但是当我想启动 pgAdmin 时,我收到此错误消息。
Failed to connect to the pgAdmin application server. Click here to try again.
无法连接到 pgAdmin 应用程序服务器。单击此处重试。
I have also Mysql installed on my machine if it can make any complications.
我的机器上也安装了 Mysql,如果它可以使任何复杂。
回答by Sorin C?linic?
The same problem happened to me today:
同样的问题今天发生在我身上:
And this is how I've solved it:
这就是我解决它的方法:
1)Use a text editor to open the config_distro.pyfile under the c:\Program Files\pgAdmin 4\v1\webfolder. Change the value for SERVER_MODEfrom Trueto False, then save the change. (I have run Notepad++ as an Administrator, in order to be able to save in this protected folder.)
1)使用文本编辑器打开config_distro.py下文件C:\ Program Files文件\ pgAdmin的4 \ V1 \网络文件夹。将SERVER_MODE的值从True更改为False,然后保存更改。(我以管理员身份运行 Notepad++,以便能够保存在这个受保护的文件夹中。)
2)Go to folder c:\Users\your_name\AppData\Roaming\pgAdminand make sure there is nothing there (delete all the files, as they are temporary and will be restored after starting pgAdmin)
2)转到文件夹c:\Users\your_name\AppData\Roaming\pgAdmin并确保那里没有任何内容(删除所有文件,因为它们是临时的,将在启动pgAdmin后恢复)
3)Start pgAdmin
3)启动pgAdmin
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).
4)这次你会看到一个白色的盒子——至少,在我慢速的笔记本电脑上——大约 20 秒。(您可能会简要地看到原始错误消息,但不要担心)。
5)Meanwhile, the temporary files - required for running the application - are created.
5)同时,创建运行应用程序所需的临时文件。
6)Once the temporary files process is over, the application starts as expected.
6)临时文件处理结束后,应用程序将按预期启动。
回答by Daniel Stracabo?ko
Try starting the pgAdmin as administrator.
尝试以管理员身份启动 pgAdmin。
回答by Lucas Gervas
My config_distro.py
was missing this line:
我config_distro.py
错过了这一行:
MINIFY_HTML=False
I added it as in the above steps and it works
我在上面的步骤中添加了它并且它有效
回答by Shashank
In my case, SERVER_MODE was already False in config_distro.py. I then proceeded to start pgadmin4 as an administrator. This also did not work. Finally, I resolved this by restarting postgresql service in services.msc. postgres service restart
就我而言, SERVER_MODE 在 config_distro.py 中已经为 False。然后我继续以管理员身份启动 pgadmin4。这也不起作用。最后,我通过在 services.msc 中重新启动 postgresql 服务解决了这个问题。 postgres 服务重启
回答by NBender
You can start the server manually - any errors will echo on the terminal. The windows app seems touchy on timing - this allows the server to take as much time as needed to start up.
您可以手动启动服务器 - 任何错误都会在终端上回显。Windows 应用程序在时间上似乎很敏感 - 这允许服务器根据需要花费尽可能多的时间来启动。
Assuming you installed version 3 into "p:\pgAdmin 4" run the following commands"
假设您将版本 3 安装到“p:\pgAdmin 4”中,请运行以下命令”
p:
cd "\pgAdmin 4\v3\web"
set PYTHONPATH=P:\pgAdmin 4\v3\venv\Lib;P:\pgAdmin 4\v3\venv\DLLs
python pgAdmin4.py
When I run that I get the following output:
当我运行它时,我得到以下输出:
Starting pgAdmin 4. Please navigate to http://127.0.0.1:5050 in your browser.
回答by cybersoft
In my case, the problem was non-ascii username.
就我而言,问题是非 ascii 用户名。
Find pgAdmin installation and open/create config_local.py
in editor, add this:
找到 pgAdmin 安装并config_local.py
在编辑器中打开/创建,添加以下内容:
DATA_DIR = "C:/Data/pgAdmin" # set non-ascii path here
and run setup.py
using python interpreter.
并setup.py
使用 python 解释器运行。
回答by Abby Jones
I ran into this today even though the service was running in Windows 10. I just stopped the service, gave it a few seconds, and restarted it. I was able to connect with pgAdmin 4.
即使该服务在 Windows 10 中运行,我今天也遇到了这个问题。我只是停止了该服务,给了它几秒钟,然后重新启动它。我能够与 pgAdmin 4 连接。