Я пытаюсь использовать Django и Haystack с Elasticsearch в качестве backend на Ubuntu 14.04. У меня есть Elasticsearch и Haystack.Не удается заставить Elasticsearch работать с Django
ошибка я получаю, когда я бегу питона manage.py runserver:
[email protected]:$ python manage.py runserver
Validating models...
0 errors found
January 31, 2015 - 17:40:37
Django version 1.5.4, using settings 'website_project.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
File "/home/me/.pythonbrew/pythons/Python-2.7.5/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/usr/local/lib/python2.7/dist-packages/django/contrib/staticfiles/handlers.py", line 72, in __call__
return self.application(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/wsgi.py", line 243, in __call__
signals.request_started.send(sender=self.__class__)
File "/usr/local/lib/python2.7/dist-packages/django/dispatch/dispatcher.py", line 170, in send
response = receiver(signal=self, sender=sender, **named)
File "/usr/local/lib/python2.7/dist-packages/haystack/__init__.py", line 60, in reset_search_queries
for conn in connections.all():
File "/usr/local/lib/python2.7/dist-packages/haystack/utils/loading.py", line 111, in all
return [self[alias] for alias in self.connections_info]
File "/usr/local/lib/python2.7/dist-packages/haystack/utils/loading.py", line 99, in __getitem__
self._connections[key] = load_backend(self.connections_info[key]['ENGINE'])(using=key)
File "/usr/local/lib/python2.7/dist-packages/haystack/utils/loading.py", line 52, in load_backend
return import_class(full_backend_path)
File "/usr/local/lib/python2.7/dist-packages/haystack/utils/loading.py", line 19, in import_class
module_itself = importlib.import_module(module_path)
File "/usr/local/lib/python2.7/dist-packages/django/utils/importlib.py", line 35, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/haystack/backends/elasticsearch_backend.py", line 26, in <module>
raise MissingDependency("The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.")
MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.
Мой PYTHONPATH является
home/me/.pythonbrew/pythons/Python-2.7.5/lib:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
У меня есть 'стог' в моем списке INSTALLED_APPS и имеют следующие конфигурации:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
я могу начать Elasticsearch с
sudo service elasticsearch start
и когда я иду в http://localhost:9200/ я вижу
{
"status" : 200,
"name" : "Stranger",
"version" : {
"number" : "1.1.1",
"build_hash" : "somehash",
"build_timestamp" : "2014-04-16T14:27:12Z",
"build_snapshot" : false,
"lucene_version" : "4.7"
},
"tagline" : "You Know, for Search"
}
Похоже, у меня Elasticsearch установлен, так что я не знаю, почему я получаю ошибку
MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.
.
Вы добавили elasticsearch в свой INSTALLED_APPS в settings.py? –
Нет, я этого не делал. Я добавил его, и теперь, когда я пытаюсь запустить сервер, я получаю «ImportError: No module с именем _ssl». – user2121620
Имеет ли это значение? http://stackoverflow.com/questions/5128845/importerror-no-module-named-ssl –