Reputation: 676
I'm trying to use Django and Haystack with Elasticsearch as the backend on Ubuntu 14.04. I have Elasticsearch and Haystack installed.
The error I receive when I run python manage.py runserver:
me@ubuntu:$ 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.
My PYTHONPATH is
home/me/.pythonbrew/pythons/Python-2.7.5/lib:/usr/local/lib/python2.7/dist-packages:/usr/lib/python2.7/dist-packages
I have 'haystack' in my list of INSTALLED_APPS and have the following config:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
'URL': 'http://127.0.0.1:9200/',
'INDEX_NAME': 'haystack',
},
}
I can start Elasticsearch with
sudo service elasticsearch start
and when I go to http://localhost:9200/ I see
{
"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"
}
It seems like I have Elasticsearch installed so I don't know why I am getting the
MissingDependency: The 'elasticsearch' backend requires the installation of 'elasticsearch'. Please refer to the documentation.
error.
Upvotes: 3
Views: 3040
Reputation: 19969
Seems you've already fixed it, but for future Googlers: some people have trouble with the Haystack versions on pip around 2014-2015. Fixing the version at 2.1.0 seems to fix it, as does downloading 2.4.0 directly from git:
pip install git+https://github.com/django-haystack/django-haystack
UPDATE: The current version of haystack in pypi works (nov 2015), be sure to update!
Upvotes: 6