私はDjangoアプリケーションのデータベースとしてelasticsearchを使用しています。私はpython manage.py rebuild_index
を実行するたびに、私は次のエラーを思い付く:settings.DATABASESが不適切に構成されています(弾性検索)
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.
。ヘイスタック接続のための私のsettings.pyは次のとおりです。
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
を実行していたものを実行し、エラーが、私はそこに – Exprator
を発生しているとして、データベースの設定を表示データベースのセクションを理解していません。 DATABASE設定を宣言すべきか、HAYSTACK_CONNECTIONSがデータベース接続の役割を果たすのでしょうか?私がデータベース設定を書く必要がある場合、私はelasticsearchで私のdjangoアプリケーションを接続するためにそれを書くべきですか? –
haystack接続がデータベースと異なっていない場合は、設定ファイルでDATABASE設定を宣言する必要があります。それ以外の場合は実行しないでください – Exprator