【问题标题】:Why I cannot create a database for graphite-web?为什么我不能为石墨网络创建数据库?
【发布时间】:2014-06-23 13:14:56
【问题描述】:

我正在尝试按照以下说明在我的计算机上安装graphite-web https://gist.github.com/surjikal/2777886。当我尝试使用 manage.py syncdb 填充数据库时,它找不到合适的数据库并引发以下错误:

> sudo python manage.py syncdb
OperationalError: FATAL:  database "/opt/graphite/storage/graphite.db" does not exist

在这里你可以找到我从local_settings.py的数据库配置:

DATABASES = {
    'default': {
        'NAME': '/opt/graphite/storage/graphite.db',
        'ENGINE': 'django.db.backends.postgresql_psycopg2',
        'USER': 'graphite',
        'PASSWORD': '<password>',
        'HOST': 'localhost',
        'PORT': '5678'
    }
}

Postgres 运行正常:

sudo service --status-all | grep postgres 
...
[ + ]  postgresql

为什么manage.py syncdb 无法创建/找到graphite.db 文件?

【问题讨论】:

  • 如果您使用的是 postgresql,则不需要数据库路径。您只需要数据库名称。
  • @anuragal:谢谢 - 它解决了问题! :) 请添加您的评论作为我可以接受的答案。

标签: python django postgresql graphite


【解决方案1】:

如果您使用的是 postgresql,则不需要数据库路径。您只需要数据库名称。喜欢

DATABASES = {
'default': {
    'NAME': 'graphite',
    'ENGINE': 'django.db.backends.postgresql_psycopg2',
    'USER': 'graphite',
    'PASSWORD': '<password>',
    'HOST': 'localhost',
    'PORT': '5678'
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-06-04
    • 1970-01-01
    • 2018-04-17
    • 2011-01-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-01-28
    相关资源
    最近更新 更多