2012-03-24 28 views
20

Tôi đang cố gắng cài đặt GRAPHITE trên ubuntu. Tôi làm theo hướng dẫn trong blog.Lỗi Django khi cài đặt Graphite - settings.DATABASES được định cấu hình không đúng. Vui lòng cung cấp giá trị ENGINE

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

Khi tôi đến phần nơi tôi chạy lệnh..Tôi nhận được lỗi dưới đây. Tôi không có manh mối về cách giải quyết. Tôi đang sử dụng phiên bản mới nhất của 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. 

Trong /opt/graphite/webapp/graphite/settings.py tệp, đây là nội dung.

#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') 

Trả lời

9

Bạn cần chỉnh sửa settings.py và đặt nội dung của biến số DATABASES thành một thứ khác ngoài chuỗi trống. Có ý kiến ​​bên cạnh nó cho bạn biết mà cơ sở dữ liệu được hỗ trợ:

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

Nếu bạn không có gì khác được cài đặt, bạn có thể nối thêm sqlite3 vào chuỗi ENGINE đó là dễ dàng để phát triển trên máy tính địa phương của bạn.

+0

Xin chào, hãy xem chỉnh sửa của tôi. Đó là tập tin cài đặt được tạo. – Tampa

+0

Bạn đang sử dụng phiên bản Django nào? Tệp cài đặt của bạn có nhiều biến 'DATABASE_' trong đó (đó là cách cũ để làm) trong khi Django của bạn dường như đang tìm biến' DATABASES' (đây là cách mới để cấu hình các thiết lập cơ sở dữ liệu). –

+0

Tôi đang sử dụng 1,4 từ thân cây – Tampa

1

Tôi chỉ cần thêm vào từ điển CƠ SỞ DỮ LIỆU đến cuối của tập tin, nó works.I hy vọng các graphite có thể chạy dựa trên Django 1.4.1

14

graphite version 0.9.10 supports Django 1.4 ... tuy nhiên họ đặt các thiết lập sqlite trong của django local_settings.py

[[email protected] graphite]$ cat local_settings.py|grep -v \# 
DATABASES = { 
    'default': { 
     'NAME': '/opt/graphite/storage/graphite.db', 
     'ENGINE': 'django.db.backends.sqlite3', 
     'USER': '', 
     'PASSWORD': '', 
     'HOST': '', 
     'PORT': '' 
    } 
} 
[[email protected] graphite]$ 
[[email protected] graphite]$ pwd 
/opt/graphite/webapp/graphite 
[[email protected] graphite]$ 
9

Đối với người dùng hạ cánh ở đây với các thông báo lỗi "thiết lập SECRET_KEY không được bỏ trống", hãy chắc chắn để thiết lập các khóa bí mật trong /opt/graphite/webapp/graphite/app_settings.py cũng như trong cấu hình django của bạn.

Các vấn đề liên quan