我一直在遵循Django girls教程来学习Django Web框架。
我已达到本教程的this part。现在,当我运行命令python manage.py migrate
时,我完全陷入了困境。
我什至不能再在本地主机上运行服务器,runserver会带来同样的错误。自从我更改settings.py文件以容纳Postgres数据库以来,所有这些错误开始出现。
我非常需要帮助。
我从以前(版本11.4)安装了postgres。看到这些错误后,按照上述教程的说明,我将其删除,然后再次下载。这是无用的努力,因为出现了同样的问题。
Traceback (most recent call last): File "/home/jpsofficedev/Documents/coding_for_girls/djangogirls/myvenv/lib64/python3.7/site-packages/django/db/backends/base/base.py", line 216, in ensure_connection
self.connect() File "/home/jpsofficedev/Documents/coding_for_girls/djangogirls/myvenv/lib64/python3.7/site-packages/django/db/backends/base/base.py", line 194, in connect
self.connection = self.get_new_connection(conn_params) File "/home/jpsofficedev/Documents/coding_for_girls/djangogirls/myvenv/lib64/python3.7/site-packages/django/db/backends/postgresql/base.py", line 168, in get_new_connection
connection = Database.connect(**conn_params)
File "/home/jpsofficedev/Documents/coding_for_girls/djangogirls/myvenv/lib64/python3.7/site-packages/psycopg2/__init__.py", line 126, in connect
conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL: Ident authentication failed for user "jpsofficedev"
settings.py中的数据库设置
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'djangogirls',
'USER': 'jpsofficedev',
'PASSWORD': '',
'HOST': '127.0.0.1',
'PORT': '',
}
}
为了更好地了解我所做的事情,我提供了指向该项目的github个人资料的链接。 https://github.com/bhawanabadlani/my-first-blog
我在Postgres的经验为空。对于某些教程和文档的建议也将不胜感激。
this is my pg_hba.conf file. Is there some problem in it's settings
答案 0 :(得分:0)
谢谢您的链接@DEEPAK KUMAR https://serverfault.com/questions/406606/postgres-error-message-fatal-ident-authentication-failed-for-user。 我点击了此链接,并更改了
host all all 127.0.0.1/32 ident
到
host all all 127.0.0.1/32 trust
在pg_hba.conf文件中。这解决了我面临的问题。