settings.DATABASES 配置不正确 (Elasticsearch)

settings.DATABASES is improperly configured (Elasticsearch)

我正在使用 elasticsearch 作为我的 Django 应用程序的数据库。但是每当我 运行 python manage.py rebuild_index 我想出以下错误:

Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
    utility.execute()
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/base.py", line 305, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 37, in handle
    call_command('update_index', **options)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/__init__.py", line 130, in call_command
    return command.execute(*args, **defaults)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/core/management/base.py", line 356, in execute
    output = self.handle(*args, **options)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 214, in handle
    self.update_backend(label, using)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 240, in update_backend
    total = qs.count()
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/query.py", line 369, in count
    return self.query.get_count(using=self.db)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/query.py", line 476, in get_count
    number = obj.get_aggregation(using, ['__count'])['__count']
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/query.py", line 457, in get_aggregation
    result = compiler.execute_sql(SINGLE)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 824, in execute_sql
    sql, params = self.as_sql()
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 374, in as_sql
    from_, f_params = self.get_from_clause()
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 612, in get_from_clause
    clause_sql, clause_params = self.compile(from_clause)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 353, in compile
    sql, params = node.as_sql(self, self.connection)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/datastructures.py", line 146, in as_sql
    base_sql = compiler.quote_name_unless_alias(self.table_name)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 344, in quote_name_unless_alias
    r = self.connection.ops.quote_name(name)
  File "/Manish/Projects/Spark/ad-tracking-django-env/lib/python2.7/site-packages/django/db/backends/dummy/base.py", line 21, 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.

主要错误是:

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.

我也在使用 Haystack 作为我的搜索引擎。我的 Haystack 连接 settings.py 是:

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine',
        'URL': 'http://127.0.0.1:9200/',
        'INDEX_NAME': 'haystack',
    },
}
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.sqlite3',
        'NAME': 'mydatabase',
    }
}

创建一个名为 db.sqlite3 的文件,其中 manage.py 是,然后 运行 你是 运行ning