[英]Django Haystack - No module named 'haystack.backends.elasticsearch5_backend'
Im following the install instructions as per the haystack documentation http://docs.haystacksearch.org/en/master/tutorial.html#installation and the search engine installation https://django-haystack.readthedocs.io/en/master/installing_search_engines.html#elasticsearch我按照 haystack 文档http://docs.haystacksearch.org/en/master/tutorial.html#installation和搜索引擎安装https://django-haystack.readthedocs.io/en/master/ 遵循安装说明安装搜索引擎.html#elasticsearch
I have installed Elasticsearch 5.1.16 which is listed as compatible and have put the settings in, the installation guide only has examples for Elasticsearch versions 1 and 2 but states that 5 is supported.我已经安装了 Elasticsearch 5.1.16,它被列为兼容并已将设置放入,安装指南仅包含 Elasticsearch 版本 1 和 2 的示例,但声明支持 5。
so I changed to version 5 in the settings所以我在设置里改成了版本5
'default': {
'ENGINE': 'haystack.backends.elasticsearch5_backend.Elasticsearch5SearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
I have also gone through the repo and can see that version 5 is in there我也浏览了 repo,可以看到第 5 版在那里
but when I start my server I receive the error:但是当我启动我的服务器时,我收到了错误:
return _bootstrap._gcd_import(name[level:], package, level)
ModuleNotFoundError: No module named 'haystack.backends.elasticsearch5_backend'
but then when I traverse the folder structure it hasn't installed the version 5 files但是当我遍历文件夹结构时,它没有安装第 5 版文件
root@4c1197e002e8:/myapp/# ls /usr/local/lib/python3.6/site-packages/haystack/backends/
__init__.py __pycache__/ elasticsearch2_backend.py elasticsearch_backend.py simple_backend.py solr_backend.py whoosh_backend.py
and im using the same version as the git repo that has the 5 backend in it?并且我使用与其中包含 5 个后端的 git 存储库相同的版本?
root@4c1197e002e8:/myapp/# pip freeze | root@4c1197e002e8:/myapp/# pip 冻结 | grep hay django-haystack==2.8.1
grep 干草 django-haystack==2.8.1
EDIT: its also already installed into my installed apps:编辑:它也已经安装到我安装的应用程序中:
INSTALLED_APPS = (
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'haystack',
...
anyone help me out whats missing here?有人帮我看看这里缺少什么吗? Thanks
谢谢
I just did a pip install git+https://github.com/django-haystack/django-haystack
and now the version5
backend is in there.我刚刚做了一个
pip install git+https://github.com/django-haystack/django-haystack
现在version5
5后端在那里。
I was using pipenv:我正在使用 pipenv:
pipenv install git+https://github.com/django-haystack/django-haystack.git#egg=django-haystack
A modification of AlexW's answer worked for me! AlexW 的答案的修改对我有用!
You need to add 'haystack' in your installed app您需要在已安装的应用程序中添加“干草堆”
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
# Added.
'haystack',
# Then your usual apps...
'blog',
] ]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.