ubuntu 如何解析django.db.utils.OperationalError:连接到服务器“127.0.0.1”,端口5432失败:数据库“graphite.db”不存在

ryevplcw  于 2023-08-03  发布在  Go
关注(0)|答案(1)|浏览(126)

我正在尝试在ubuntu box中安装graphite,我正在运行Ubuntu 22.04.2 LTS(GNU/Linux 5.15.0-43-generic x86_64)这些是数据库的local_settings.py文件中的设置

DATABASES = {
'default': {
'NAME': 'graphite.db',
'ENGINE': 'django.db.backends.postgresql_psycopg2',
'USER': 'graphite',
'PASSWORD': '\*\*\*\*\*',
'HOST': '127.0.0.1',
'PORT': '5432'
}
}

字符串
执行sudo graphite-manage migrate auth时收到以下错误

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/django/db/backends/base/base.py", line 219, in ensure_connection
self.connect()
File "/usr/lib/python3/dist-packages/django/utils/asyncio.py", line 33, in inner
return func(\*args, \*\*kwargs)
File "/usr/lib/python3/dist-packages/django/db/backends/base/base.py", line 200, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/lib/python3/dist-packages/django/utils/asyncio.py", line 33, in inner
return func(\*args, \*\*kwargs)
File "/usr/lib/python3/dist-packages/django/db/backends/postgresql/base.py", line 187, in get_new_connection
connection = Database.connect(\*\*conn_params)
File "/usr/lib/python3/dist-packages/psycopg2/__init__.py", line 122, in connect
conn = \_connect(dsn, connection_factory=connection_factory, \*\*kwasync)
psycopg2.OperationalError: connection to server at "127.0.0.1", port 5432 failed: FATAL:  database "graphite.db" does not exist


我保证石墨用户已经创建并且已经给予足够的权限。我尝试了django.db.backends.postgresql等不同的引擎,但仍然面临同样的问题

vngu2lb8

vngu2lb81#

graphite.db不存在,因为它尚未创建,您可能必须手动创建数据库并在运行sudo graphite-manage migrate auth之前设置权限

相关问题