2016-03-31 8 views
0

私はdjango-haystackを使用して自分のプロジェクトにElasticsearchをインストールしようとしています。私はこのtutorialを使用していますが、私はdjano-haystack rebuild_indexコマンドが失敗しました

./manage.py rebuild_index

コマンドを実行したときに、私はこのエラーを取得:

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

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

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 

環境:

  • ジャンゴ== 1.9.2
  • ジャンゴ、干し草の山== 2.5.dev0
  • elasticsearch == 2.3.0
  • elasticsearch-DSLの== 2.0.0
  • ログ== 0.4.9.6
  • pyelasticsearch == 1.4
  • urllib3 == 1.14
+0

はあなたがピップジャンゴ - 干し草の== 2.4.1をインストールし、私はジャンゴ - 干し草の山を必要とする – Mounir

+0

を再確認してみてくださいテンプレートを作成していなかった(あるいは、それは間違った名前を持つ)ものです== 2.5私はdjango 1.9を使用しています.dev0。これを参照してください[github issue](https://github.com/django-haystack/django-haystack/issues/1282) – user3196760

+0

haystack 2.4.1を使用しようとすると 'rebuild_index'コマンドは機能しますが、' AttributeError: 'module'オブジェクトには属性 'get_model'がありません。 – user3196760

答えて

0

私はこれがhaystack==2.5.dev0の具体的なエラーだと思います。 理由はsearch/indexes/myapp/modelname_text.txt

関連する問題