我尝试通过Django-haystack使用弹性搜索。我想通过添加Django-haystack的参数--workers=10
来更快地更新索引。然后我得到下面的错误。
Traceback (most recent call last):
File "c:\users\watas\appdata\local\programs\python\python36-32\Lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "c:\users\watas\appdata\local\programs\python\python36-32\Lib\multiprocessing\process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "c:\users\watas\appdata\local\programs\python\python36-32\Lib\multiprocessing\pool.py", line 108, in worker
task = get()
File "c:\users\watas\appdata\local\programs\python\python36-32\Lib\multiprocessing\queues.py", line 337, in get
return _ForkingPickler.loads(res)
File "C:\Users\watas\Documents\code\InteRed-2018\creators\models.py", line 6, in <module>
class Channel(models.Model):
File "C:\Users\watas\Documents\code\dj_env\lib\site-packages\django\db\models\base.py", line 100, in __new__
app_config = apps.get_containing_app_config(module)
File "C:\Users\watas\Documents\code\dj_env\lib\site-packages\django\apps\registry.py", line 244, in get_containing_app_config
self.check_apps_ready()
File "C:\Users\watas\Documents\code\dj_env\lib\site-packages\django\apps\registry.py", line 127, in check_apps_ready
raise AppRegistryNotReady("Apps aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet.
这是我的配置。
Django = 2.0.3
django-haystack = 2.8.1
python = 3.6.4
在Virtualenv 16.1.0中使用
在没有--worker
的情况下运行良好。
已更新 我发现使用Elasticsearch 5.X比1.x快。 但是在建立索引之后,我发现干草堆实际上不支持Elasticsearch 5.X。