安装Graphite时出现Django错误 - settings.DATABASES配置不正确.请提供ENGINE值

Tam*_*mpa 20 python django django-settings

我想在ubuntu上安装GRAPHITE.我按照博客中的说明操作.

http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/
Run Code Online (Sandbox Code Playgroud)

当我到达运行命令的部分时......我得到以下错误.我对如何解决没有任何线索.我正在使用最新版本的Django 1.4.

cd /opt/graphite/webapp/graphite/
sudo python manage.py syncdb


sudo python manage.py syncdb
/opt/graphite/webapp/graphite/thirdparty/pytz/__init__.py:32: UserWarning: Module pytz was already imported from /opt/graphite/webapp/graphite/thirdparty/pytz/__init__.pyc, but /usr/local/lib/python2.7/dist-packages/pytz-2012b-py2.7.egg is being added to sys.path
  from pkg_resources import resource_stream
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 459, in execute_manager
    utility.execute()
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 382, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 196, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 232, in execute
    output = self.handle(*args, **options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 371, in handle
    return self.handle_noargs(**options)
  File "/usr/local/lib/python2.7/dist-packages/django/core/management/commands/syncdb.py", line 57, in handle_noargs
    cursor = connection.cursor()
  File "/usr/local/lib/python2.7/dist-packages/django/db/backends/dummy/base.py", line 15, in complain
    raise ImproperlyConfigured("settings.DATABASES is improperly configured. "
django.core.exceptions.ImproperlyConfigured: settings.DATABASES is improperly configured. Please supply the ENGINE value. Check settings documentation for more details.
Run Code Online (Sandbox Code Playgroud)

在/opt/graphite/webapp/graphite/settings.py文件中,这是内容.

#Database settings, sqlite is intended for single-server setups
DATABASE_ENGINE = 'sqlite3'                     # 'postgresql', 'mysql', 'sqlite3' or 'ado_mssql'.
DATABASE_NAME = STORAGE_DIR + 'graphite.db'     # Or path to database file if using sqlite3.
DATABASE_USER = ''                              # Not used with sqlite3.
DATABASE_PASSWORD = ''                          # Not used with sqlite3.
DATABASE_HOST = ''                              # Set to empty string for localhost. Not used with sqlite3.
DATABASE_PORT = ''                              # Set to empty string for default. Not used with sqlite3.

DASHBOARD_CONF = join(CONF_DIR, 'dashboard.conf')
GRAPHTEMPLATES_CONF = join(CONF_DIR, 'graphTemplates.conf')
Run Code Online (Sandbox Code Playgroud)

Mik*_*ton 14

石墨版本0.9.10支持Django 1.4 ...但是他们将sqlite设置放在django中local_settings.py

[mpenning@tsunami graphite]$ cat local_settings.py|grep -v \#
DATABASES = {
    'default': {
        'NAME': '/opt/graphite/storage/graphite.db',
        'ENGINE': 'django.db.backends.sqlite3',
        'USER': '',
        'PASSWORD': '',
        'HOST': '',
        'PORT': ''
    }
}
[mpenning@tsunami graphite]$
[mpenning@tsunami graphite]$ pwd
/opt/graphite/webapp/graphite
[mpenning@tsunami graphite]$
Run Code Online (Sandbox Code Playgroud)


Sim*_*ser 9

您需要编辑变量settings.py的内容并将其设置为DATABASES空字符串以外的其他内容.旁边有评论告诉您支持哪些数据库引擎:

DATABASES = {
   'default': {
        'ENGINE': 'django.db.backends.', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
        'NAME': '',                      # Or path to database file if using sqlite3.
        'USER': '',                      # Not used with sqlite3.
        'PASSWORD': '',                  # Not used with sqlite3.
        'HOST': '',                      # Set to empty string for localhost. Not used with sqlite3.
        'PORT': '',                      # Set to empty string for default. Not used with sqlite3.
    }
}
Run Code Online (Sandbox Code Playgroud)

如果您没有安装任何其他内容,则可以附加sqlite3ENGINE本地计算机上易于开发的字符串.

  • 解决了...我删除了django 1.4并使用sudo apt-get install python-django安装.我猜石墨不喜欢1.4 (3认同)

小智 9

对于登陆此处并显示错误消息"SECRET_KEY设置不能为空"的用户,请确保在/opt/graphite/webapp/graphite/app_settings.py以及django配置中设置密钥.