简体   繁体   English

姜戈; django.db.utils.OperationalError: 致命: 没有主机、用户、数据库的 pg_hba.conf 条目

[英]Django; django.db.utils.OperationalError: FATAL: no pg_hba.conf entry for host, user, database

I'm a beginner and I've been creating a Django project.我是初学者,我一直在创建一个 Django 项目。 I'm trying to switch sqlite3 db to postgresql .我正在尝试将sqlite3 db 切换到postgresql But when I do make migrations , this error occurred.但是当我做make migrations ,发生了这个错误。

django.db.utils.OperationalError: FATAL: no pg_hba.conf entry for host, user, database django.db.utils.OperationalError: 致命: 没有主机、用户、数据库的 pg_hba.conf 条目

I searched about this error.我搜索了这个错误。 And some people checked pg_hba.conf file, but I have no idea where this file is.有些人检查了pg_hba.conf文件,但我不知道这个文件在哪里。

Also when I created project before and did the same thing, there's no this error.此外,当我之前创建项目并做同样的事情时,没有这个错误。 Why is this error happening this time?这次为什么会出现这个错误? What is the cause?原因是什么?

How can I fix this error?我该如何解决这个错误?

Here is configuration part in settings.py这是settings.py配置部分

DATABASES = {
'default': {

    #elephantsql
    'ENGINE': 'django.db.backends.postgresql',
    'NAME': os.environ.get('DATABASE_NAME', ''),
    'USERS': os.environ.get('DATABASE_USER', ''),
    'PASSWORD': os.environ.get('DATABASE_PASSWORD', ''),
    'HOST': os.environ.get('DATABASE_HOST', ''),
    'PORT': os.environ.get('DATABASE_PORT'),
    }
}

Looks like a typo to me :对我来说看起来像是一个错字:
'USERS': os.environ.get('DATABASE_USER', ''),
should probably be:应该是:
'USER': os.environ.get('DATABASE_USER', ''),

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 OperationalError:严重:主机“ 127.0.0.1”,用户“ fibzadmin”,数据库“ fibz”,关闭SSL时没有pg_hba.conf条目 - OperationalError : FATAL: no pg_hba.conf entry for host “127.0.0.1”, user “fibzadmin”, database “fibz”, SSL off 错误:'没有主机的 pg_hba.conf 条目' 将 Django 与 PostgreSQL 一起使用? - Error: 'no pg_hba.conf entry for host' using Django with PostgreSQL? psycopg2.OperationalError:SSL SYSCALL 错误:对等方重置连接 (0x00002746/10054) 致命:主机用户数据库没有 pg_hba.conf 条目 - psycopg2.OperationalError: SSL SYSCALL error: Connection reset by peer (0x00002746/10054) FATAL: no pg_hba.conf entry for host user database sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: no pg_hba.conf entry for host,没有改变任何东西 - sqlalchemy.exc.OperationalError: (psycopg2.OperationalError) FATAL: no pg_hba.conf entry for host, didnt change anything 如何在127.0.0.1:8000上再次运行django项目? 没有主机的pg_hba.conf条目 - How to run django project again on 127.0.0.1:8000? no pg_hba.conf entry for host 将 Django 连接到 Postgres:django.db.utils.OperationalError:致命:数据库“DATABASENAME”不存在 - Connecting Django to Postgres: django.db.utils.OperationalError: FATAL: database "DATABASENAME" does not exist Django 错误:django.db.utils.OperationalError:致命:用户对等身份验证失败 - Django error: django.db.utils.OperationalError: FATAL: Peer authentication failed for user django.db.utils.OperationalError:致命:用户“vagrant”的密码验证失败 - django.db.utils.OperationalError: FATAL: password authentication failed for user “vagrant” django.db.utils.OperationalError: 没有这样的表 Django 2 - django.db.utils.OperationalError: no such table Django 2 asyncpg 错误:Heroku 中的“主机没有 pg_hba.conf 条目” - asyncpg error: "no pg_hba.conf entry for host" in Heroku
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM