I have been following a tutorial from 'Django by example' that introduces Solr and Haystack and run into a problem. I have made the necessary changes to INSTALLED_APPS in settings.py and also added the following:
HAYSTACK_CONNECTIONS = {
'default': {
'ENGINE': 'haystack.backends.solr_backends.SolrEngine',
'URL': 'http://127.0.0.1:8938/solr/blog'
},
}
then I run
python manage.py build_solr_schema
and I get this error
ImportError: No module named 'haystack.backends.solr_backends'
this is my search_indexes.py file
from haystack import indexes
from .models import Post
class PostIndex(indexes.SearchIndex, indexes.Indexable):
text = indexes.CharField(document=True, use_template=True)
publish = indexes.DateTimeField(model_attr='publish')
def get_model(self):
return Post
def index_queryset(self, using=None):
return self.get_model().published.all()
when I run django shell Im able to import haystack just fine but when I run the following:
from haystack.query import SearchQuerySet
sqs = SearchQuerySet().all()
sqs.count()
I get the exact same error right after entering the 2nd line.
I have tried restarting Solr, still doesn't work.
I have Solr working fine locally and have created a new core within the admin and have all the files setup here and have all the required files copied over from the example folder that comes with the install:
/usr/local/opt/solr/server/solr/blog/conf
what am I missing here? thanks
EDIT: Id like to add that I have installed django-haystack and pysolr with a venv but both show up if I do pip freeze. Solr was installed via Homebrew.