[英]postgresql auth django (password authentication failed for user "BlogAdmin2")
I followed the tutorial posted by Digital Ocean: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04#create-and-configure-a-new-django-project (How to set up django with postgres nginx and gunicorn on ubuntu) I created a git hub private repo with the website and when I created the postgresql database with the folowing commands:我遵循了 Digital Ocean 发布的教程: https : //www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 #create-and-configure-a-new-django-project (如何在 ubuntu 上使用 postgres nginx 和 gunicorn 设置 django)我在网站上创建了一个 git hub 私有仓库,当我使用以下命令创建 postgresql 数据库时:
CREATE DATABASE PiaBlog;
CREATE USER BlogAdmin WITH PASSWORD 'Andrei1234';
ALTER ROLE BlogAdmin SET client_encoding TO 'utf8';
ALTER ROLE BlogAdmin SET default_transaction_isolation TO 'read committed';
ALTER ROLE BlogAdmin SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE PiaBlog TO BlogAdmin;
\q
and here is my django database config:这是我的 Django 数据库配置:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'PiaBlog',
'USER': 'BlogAdmin',
'PASSWORD': 'Andrei1234,',
'HOST': 'localhost',
'PORT': '',
}
}
When I run python manage.py migrate
I get :当我运行python manage.py migrate
我得到:
django.db.utils.OperationalError: FATAL: password authentication failed for user "BlogAdmin2"
FATAL: password authentication failed for user "BlogAdmin2"
Does somebody know why do I get this problem I spent an hour searching for a typing error and I never found it.有人知道我为什么会遇到这个问题吗?我花了一个小时寻找打字错误,但我从未找到。
Then I created a new user and I had this error:然后我创建了一个新用户,我遇到了这个错误:
django.db.utils.OperationalError: FATAL: password authentication failed for user "blog_admin"
FATAL: password authentication failed for user "blog_admin"
This is what I did:这就是我所做的:
CREATE DATABASE blogdb;
CREATE USER blog_admin WITH PASSWORD 'testing1234';
ALTER ROLE blog_admin SET client_encoding TO 'utf8';
ALTER ROLE blog_admin SET default_transaction_isolation TO 'read committed';
ALTER ROLE blog_admin SET timezone TO 'UTC';
GRANT ALL PRIVILEGES ON DATABASE blogDB TO blog_admin;
\q
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'NAME': 'blogdb',
'USER': 'blog_admin',
'PASSWORD': 'testing123',
'HOST': 'localhost',
'PORT': '',
}
}
这个逗号应该在你的密码中吗?
'PASSWORD': 'Andrei1234,',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.