Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing django-haystack

Super simple question: I went through the "getting start" doc for haystack (using whoosh; I installed both python-whoosh and haystack using pip (first time using it)), and I simply cannot run python manage.py rebuild_index. I get this error:

python manage.py rebuild_index
Unknown command: 'rebuild_index'
Type 'manage.py help' for usage

I do have 'haystack' listed in my INSTALLED_APPS in settings.py, so this solution doesn't seem to work for me. I also don't get import errors when I run "import haystack" so it does exist. I tried this on my existing project as well as a brand new object made just for this and I just can't get it to work.

However, when I import haystack after python manage.py shell and try haystack.__version__ I get "AttributeError: 'module' object has no attribute 'version'". I get a similar error if I try haystack.management: it has no management attribute.

It must be something super simple I'm missing. Thank you for reading this!

like image 875
jlugo Avatar asked Apr 16 '11 04:04

jlugo


People also ask

What is Haystack in Django?

Haystack provides modular search for Django. It features a unified, familiar API that allows you to plug in different search backends (such as Solr, Elasticsearch, Whoosh, Xapian, etc.) without having to modify your code.

What is farm haystack?

Project description. Haystack is an end-to-end framework that enables you to build powerful and production-ready pipelines for different search use cases.

What is haystack search?

Haystack is building a search engine for the inventory of local retailers, allowing you to search for a product and see the closest stores carrying it.


2 Answers

Did you perhaps install the wrong thing? This (embarrassingly) happend to me just today. Make sure you install 'django-haystack' and not just 'haystack' (and you will have to remove 'haystack', since it conflicts with 'django-haystack').

like image 173
David Avatar answered Sep 28 '22 20:09

David


  1. Do you have the path to haystack in your Python path? (Either the PYTHONPATH shell variable or the sys.path Python list.)

  2. Did you run python manage.py syncdb?

  3. Does python manage.py shell followed by import haystack work?

  4. After import haystack, what do you get for haystack.__version__?

  5. In the same shell, type the following. Do you get errors for any of them?

    • haystack.management.commands
    • haystack.management.commands.rebuild_index
    • haystack.management.commands.rebuild_index.Command.help
like image 42
Mike DeSimone Avatar answered Sep 28 '22 18:09

Mike DeSimone