gpt4 book ai didi

python - Django fe_sendauth : no password supplied error, 无法连接到 postgres 数据库

转载 作者:太空狗 更新时间:2023-10-30 02:39:36 25 4
gpt4 key购买 nike

我正在尝试为服务器提供一个以 postgresql 作为后端的 django 应用程序。在我尝试运行迁移时安装所需的包、数据库和环境后,出现以下错误

Traceback (most recent call last):
File "/var/envs/traveldbapi/lib/python3.4/site-packages/django/db/backends/base/base.py", line 213, in ensure_connection
self.connect()
File "/var/envs/traveldbapi/lib/python3.4/site-packages/django/db/backends/base/base.py", line 189, in connect
self.connection = self.get_new_connection(conn_params)
File "/var/envs/traveldbapi/lib/python3.4/site-packages/django/db/backends/postgresql/base.py", line 176, in get_new_connection
connection = Database.connect(**conn_params)
File "/var/envs/traveldbapi/lib/python3.4/site-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: fe_sendauth: no password supplied


The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "manage.py", line 22, in <module>
execute_from_command_line(sys.argv)
File "/var/envs/traveldbapi/lib/python3.4/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
utility.execute()
====
ommitting some lines
====
connection = Database.connect(**conn_params)
File "/var/envs/traveldbapi/lib/python3.4/site-packages/psycopg2/__init__.py", line 130, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
django.db.utils.OperationalError: fe_sendauth: no password supplied

我确认存在 django 所需的相关 DATABASE 设置:

DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'HOST': 'localhost',
'NAME': DATABASE_NAME,
'USER': DATABASE_USER,
'password': DATABASE_PASSWORD
}
}

我不确定为什么会发生此错误,因为这与我在本地计算机上使用的设置相同并且可以正常工作。为了确认我的 pg_hba.conf 没有任何问题,我从全新安装开始。配置未以任何方式修改,应用程序用户对应用程序数据库具有所需的权限。

最佳答案

设置必须大写 - 尝试将其更改为 'PASSWORD'

关于python - Django fe_sendauth : no password supplied error, 无法连接到 postgres 数据库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43929564/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com