服务器连接被拒绝-Django / Postgresql

时间:2020-03-11 18:01:06

标签: django postgresql

我想作为序言,一切都可以在我的另一台计算机上运行,​​但是使用我得到的新Macbook,我试图确定问题的原因。

问题是当尝试通过PostgreSQL在我的Django项目中运行python manage.py runserver时。

我确保已安装所有节点模块和依赖项,并已使用自制软件重新安装了PostgreSQL,并启动了我的postgres。

waiting for server to start....2020-03-11 13:49:40.157 EDT [88879] LOG:  starting PostgreSQL 12.2 on x86_64-apple-darwin18.7.0, compiled by Apple clang version 11.0.0 (clang-1100.0.33.17), 64-bit
2020-03-11 13:49:40.159 EDT [88879] LOG:  listening on IPv6 address "::1", port 5432
2020-03-11 13:49:40.159 EDT [88879] LOG:  listening on IPv4 address "127.0.0.1", port 5432
2020-03-11 13:49:40.160 EDT [88879] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5432"
2020-03-11 13:49:40.168 EDT [88880] LOG:  database system was shut down at 2020-03-11 13:45:10 EDT
2020-03-11 13:49:40.171 EDT [88879] LOG:  database system is ready to accept connections
 done
server started

编辑:从该问题中删除了先前的错误;换成新的** 先前的错误与端口和postgres设置有关,但是现在我收到一个致命错误,指出postgres不存在。建议?

Exception in thread django-main-thread:
Traceback (most recent call last):
  File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/db/backends/base/base.py", line 220, in ensure_connection
    self.connect()
  File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/db/backends/base/base.py", line 197, in connect
    self.connection = self.get_new_connection(conn_params)
  File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/utils/asyncio.py", line 26, in inner
    return func(*args, **kwargs)
  File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/django/db/backends/postgresql/base.py", line 185, in get_new_connection
    connection = Database.connect(**conn_params)
  File "/Users/neme/.local/share/virtualenvs/project-azure-87EjIYum/lib/python3.7/site-packages/psycopg2/__init__.py", line 126, in connect
    conn = _connect(dsn, connection_factory=connection_factory, **kwasync)
psycopg2.OperationalError: FATAL:  role "postgres" does not exist

我已经尝试过PostgreSQL error: Fatal: role "username" does not exist的解决方案 将postgres显示为未知用户。

0 个答案:

没有答案