[英]connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "rootuser" does not exist
`I am trying to connect deploy a django backend with postgres db on digitalocean droplet. `我正在尝试将 django 后端与 digitalocean droplet 上的 postgres db 连接起来。 but it's giving me this error after after gunicorn and nginx setup:
但是在 gunicorn 和 nginx 设置之后它给了我这个错误:
connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: role "rootuser" does not exist
rootuser is my root username not the db username, my db username is dbadmin rootuser 是我的根用户名而不是数据库用户名,我的数据库用户名是 dbadmin
i tried to create db user with name serveroot, it worked but started throwing other errors我尝试创建名为 serveroot 的数据库用户,它有效但开始抛出其他错误
`relation "django_site" does not exist LINE 1: ..."django_site"."domain", "django_site"."name" FROM "django_si... `关系“django_site”不存在第 1 行:...“django_site”。“domain”,“django_site”。“name”来自“django_si ...
Have a look at the docs about the settings file: https://docs.djangoproject.com/en/4.1/topics/settings/查看有关设置文件的文档: https://docs.djangoproject.com/en/4.1/topics/settings/
Look for a section like this one:寻找这样的部分:
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': YOUR_DB_NAME,
'USER': USERNAME,
'PASSWORD': PASSWORD_FOR_DB,
'HOST': 'localhost' // in Development.
}
}
and then change the NAME
, USER
, PASSWORD
and HOST
values to the ones you need.然后将
NAME
、 USER
、 PASSWORD
和HOST
值更改为您需要的值。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.