jlugo
jlugo

Reputation: 324

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!

Upvotes: 7

Views: 4820

Answers (7)

Ashok Joshi
Ashok Joshi

Reputation: 448

just do pip uninstall haystack and

pip install django-haystack

Upvotes: 0

malvadao
malvadao

Reputation: 3462

Instead of using python manage.py rebuild_index try using ./manage.py rebuild_index

Upvotes: 0

Stuart Axon
Stuart Axon

Reputation: 1874

I just had the same problem and hadn't set HAYSTACK_SITECONF in my settings.py.

Upvotes: 0

Chris Cohoat
Chris Cohoat

Reputation: 53

I had the same error that you did, and fixed it by removing the old .egg and installing directly from the latest version. You can use easy_install:

easy_install https://github.com/toastdriven/django-haystack/zipball/v1.2.4

Hope this helps!

Upvotes: 1

David
David

Reputation: 171

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').

Upvotes: 17

danodonovan
danodonovan

Reputation: 20353

I had the same problem - for whatever reason, the haystack version in pip is quite old and obsolete (v 0.6 as of today). To use django-haystack check out the v1. source.

It compiles and installs simply with

python setup.py build
python setup.py install

Hope that helps!

Upvotes: 0

Mike DeSimone
Mike DeSimone

Reputation: 42805

  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

Upvotes: 2

Related Questions