django.db.utils.OperationalError : fe_sendauth: no password supplied

标签 django git postgresql operationalerror

我已经从 github 克隆了一个 repo 并正在处理它。该项目在 django 中并使用 postgres 作为数据库。这个项目现在在生产端,我需要对其进行一些更改。数据库规范是:

DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        # Or path to database file if using sqlite3.
        'NAME': 'project_name',
        'USER': 'admin',
        'PASSWORD': '',
        # Empty for localhost through domain sockets or           '127.0.0.1'
        # for localhost through TCP.
        'HOST': 'localhost',
        'PORT': '5432',
    }
}

我想在我的本地主机上运行它,但我做不到。我收到错误:

django.db.utils.OperationalError: fe_sendauth: no password supplied

我已经搜索过这个问题,但找不到可以帮助我的解决方案。谁能告诉我问题出在哪里?

最佳答案

如果您想使用本地无密码连接,则需要删除值“HOST”、“PORT”和“PASSWORD”。

使用此配置,您的连接器将尝试使用 unix 域套接字进行连接,这是 Postgres 中默认允许的唯一允许的无密码连接

关于django.db.utils.OperationalError : fe_sendauth: no password supplied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36214127/

相关文章:

Django Rest 框架错误 : {"user": ["This field is required."]

python - Django 通用列表/详细信息类基于 View

Spring 启动 : Executing the Newer version of SQL file each time we rebuild the application

postgresql - 轻松输出表格行的hstore格式

sql - 在 PostgreSQL 中查找记录

django - “私有(private)”模型、默认查询集和链接方法

python - Django 似乎在缓存 datetime.now()

git - NetBeans 未在源代码编辑器中显示版本控制更改

git - pull 请求者应该做什么来恢复错误的提交

git - 本地备份源的自动版本控制