[英]django-haystack rebuild_index command fails
I'm trying install Elasticsearch for my project via django-haystack.我正在尝试通过 django-haystack 为我的项目安装 Elasticsearch。 I'm using this tutorial , but when I run a command我正在使用本 教程,但是当我运行命令时
./manage.py rebuild_index ./manage.py 重建索引
I get this error:我收到此错误:
Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 345, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/app/venv/local/lib/python2.7/site-packages/haystack/management/commands/rebuild_index.py", line 26, in handle
call_command('update_index', **options)
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 119, in call_command
return command.execute(*args, **defaults)
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 399, in execute
output = self.handle(*args, **options)
File "/app/venv/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 195, in handle
return super(Command, self).handle(*items, **options)
File "/app/venv/local/lib/python2.7/site-packages/django/core/management/base.py", line 548, in handle
label_output = self.handle_label(label, **options)
File "/app/venv/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 200, in handle_label
self.update_backend(label, using)
File "/app/venv/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 243, in update_backend
commit=self.commit, max_retries=self.max_retries)
File "/app/venv/local/lib/python2.7/site-packages/haystack/management/commands/update_index.py", line 107, in do_update
LOG.error(error_msg, exc_info=True, **error_context)
File "/usr/lib/python2.7/logging/__init__.py", line 1174, in error
self._log(ERROR, msg, args, **kwargs)
TypeError: _log() got an unexpected keyword argument 'retries'
models.py模型.py
class Company(models.Model):
name = models.CharField(max_length=50)
short_description = models.CharField(max_length=255)
description = models.TextField()
email = models.EmailField(unique=True)
full_address = models.TextField(null=True)
user = models.OneToOneField(User, null=True, related_name='company', on_delete=models.CASCADE)
search_indexes.py search_indexes.py
class CompanyIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
name = indexes.CharField(model_attr='name')
short_description = indexes.CharField(model_attr='short_description')
description = indexes.CharField(model_attr='description')
email = indexes.CharField(model_attr='email')
full_address = indexes.CharField(model_attr='full_address')
def get_model(self):
return Company
Environment:环境:
I think, this is specific error for haystack==2.5.dev0
.我认为,这是haystack==2.5.dev0
特定错误。 The reason is what you didn't create(or it has a wrong name) the template search/indexes/myapp/modelname_text.txt
原因是您没有创建(或名称错误)模板search/indexes/myapp/modelname_text.txt
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.