Django Haystack - MissingDependency
Django Haystack - MissingDependency
我检查了这些帖子但没有成功:
- Can't get Elasticsearch working with Django
- Error: The 'elasticsearch' backend requires the installation of 'requests'. How do I fix it?
- haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'
我的requirements.txt
appdirs==1.4.3
bcrypt==3.1.3
certifi==2017.4.17
cffi==1.10.0
chardet==3.0.4
construct==2.5.3
dj-database-url==0.4.2
Django==1.10.7
django-cors-headers==2.0.2
django-debug-toolbar==1.8
django-field-history==0.6.0
django-haystack==2.6.1
django-pandas==0.4.1
djangorestframework==3.6.2
drf-haystack==1.6.1
elasticsearch==2.4.1
future==0.16.0
gunicorn==19.7.1
idna==2.5
numpy==1.12.1
olefile==0.44
packaging==16.8
pandas==0.20.1
pefile==2016.3.28
Pillow==4.1.1
psycopg2==2.7.1
pycparser==2.17
pyparsing==2.2.0
python-dateutil==2.6.0
python-ptrace==0.9.2
pytz==2017.2
requests==2.17.3
simplejson==3.10.0
six==1.10.0
sqlparse==0.2.3
urllib3==1.21.1
whitenoise==3.3.0
我的settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#===external apps===
'rest_framework',
'rest_framework.authtoken',
'corsheaders',
'field_history',
'elasticsearch',
'haystack',
'debug_toolbar',
]
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine',
'URL': 'http://192.168.99.100:3276/',
'INDEX_NAME': 'crm',
},
}
尝试 运行 python manage.py rebuild_index
时出现以下错误:
File "C:\Users\kazi_\Documents\GitHub\esar_drf\venv\lib\site-packages\haystack\backends\elasticsearch2_backend.py", line 9, in <module>
from haystack.backends.elasticsearch_backend import ElasticsearchSearchBackend, ElasticsearchSearchQuery
File "C:\Users\kazi_\Documents\GitHub\esar_drf\venv\lib\site-packages\haystack\backends\elasticsearch_backend.py", line 33, in <module>
raise MissingDependency("The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.")
haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.
不幸的是,答案很简单。我有一个命名冲突,因为我的一个包被命名为 elasticsearch。
我检查了这些帖子但没有成功:
- Can't get Elasticsearch working with Django
- Error: The 'elasticsearch' backend requires the installation of 'requests'. How do I fix it?
- haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'
我的requirements.txt
appdirs==1.4.3
bcrypt==3.1.3
certifi==2017.4.17
cffi==1.10.0
chardet==3.0.4
construct==2.5.3
dj-database-url==0.4.2
Django==1.10.7
django-cors-headers==2.0.2
django-debug-toolbar==1.8
django-field-history==0.6.0
django-haystack==2.6.1
django-pandas==0.4.1
djangorestframework==3.6.2
drf-haystack==1.6.1
elasticsearch==2.4.1
future==0.16.0
gunicorn==19.7.1
idna==2.5
numpy==1.12.1
olefile==0.44
packaging==16.8
pandas==0.20.1
pefile==2016.3.28
Pillow==4.1.1
psycopg2==2.7.1
pycparser==2.17
pyparsing==2.2.0
python-dateutil==2.6.0
python-ptrace==0.9.2
pytz==2017.2
requests==2.17.3
simplejson==3.10.0
six==1.10.0
sqlparse==0.2.3
urllib3==1.21.1
whitenoise==3.3.0
我的settings.py
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
#===external apps===
'rest_framework',
'rest_framework.authtoken',
'corsheaders',
'field_history',
'elasticsearch',
'haystack',
'debug_toolbar',
]
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch2_backend.Elasticsearch2SearchEngine',
'URL': 'http://192.168.99.100:3276/',
'INDEX_NAME': 'crm',
},
}
尝试 运行 python manage.py rebuild_index
时出现以下错误:
File "C:\Users\kazi_\Documents\GitHub\esar_drf\venv\lib\site-packages\haystack\backends\elasticsearch2_backend.py", line 9, in <module>
from haystack.backends.elasticsearch_backend import ElasticsearchSearchBackend, ElasticsearchSearchQuery
File "C:\Users\kazi_\Documents\GitHub\esar_drf\venv\lib\site-packages\haystack\backends\elasticsearch_backend.py", line 33, in <module>
raise MissingDependency("The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.")
haystack.exceptions.MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.
不幸的是,答案很简单。我有一个命名冲突,因为我的一个包被命名为 elasticsearch。