2012-03-24 28 views
20

我試圖在Ubuntu上安裝GRAPHITE。我遵循博客中的說明。安裝Graphite時出現Django錯誤 - settings.DATABASES配置不正確。請提供ENGINE值

http://geek.michaelgrace.org/2011/09/how-to-install-graphite-on-ubuntu/ 

當我到達運行命令的部分時。我得到下面的錯誤。我對如何解決問題毫無頭緒。我正在使用最新版本的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. 

在/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') 

回答

9

你需要編輯settings.pyDATABASES變量的內容設置爲空字符串以外的東西。旁邊還有它的意見,告訴你的數據庫引擎,支持其中:

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. 
    } 
} 

如果你沒有別的安裝,你可以追加sqlite3ENGINE字符串這是很容易爲你的本地計算機上的發展。

+0

嗨,看我的編輯。這是創建的設置文件。 – Tampa 2012-03-24 16:22:21

+0

您使用的是什麼版本的Django?你的設置文件中有多個'DATABASE_'變量(這是舊的做法),而Django似乎在尋找'DATABASES'變量(這是配置數據庫設置的新方法)。 – 2012-03-24 16:25:03

+0

我使用1.4從主幹 – Tampa 2012-03-24 22:06:38

1

我只是添加數據庫字典文件的末尾,它works.I希望石墨可以運行基於Django的1.4.1

9

爲用戶提供了錯誤消息「SECRET_KEY設置不能爲空」,確保設置/opt/graphite/webapp/graphite/app_settings.py密鑰,以及在這裏登陸你的django配置。

相關問題