Installing django-haystack
Asked Answered
C

7

7

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!

Convulsive answered 16/4, 2011 at 4:26 Comment(0)
S
17

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

Sagitta answered 24/4, 2011 at 1:23 Comment(0)
I
2
  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
Iota answered 16/4, 2011 at 4:32 Comment(2)
Following your edit: it seems the import was misleading! I used to have errors on the import and fixed them. Now this happens: (1) Yes: /usr/lib/python2.6/dist-packages is in the path, and that's the folder that "haystack" is in. (2) Yes. (3) Yes. (4) I get an error! "AttributeError: 'module' object has no attribute 'version'" (5) Same error: "'module' object has no attribute'management'"Convulsive
... import haystack followed by help(haystack)? Sorry for the late response, I wasn't notified of your reply.Iota
Z
1

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!

Zachariah answered 5/7, 2011 at 14:51 Comment(0)
S
0

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!

Schlosser answered 21/4, 2011 at 22:53 Comment(1)
Hmm - Like David I had installed 'haystack' not 'django-haystack' grumble.Schlosser
D
0

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

Dinitrobenzene answered 19/9, 2012 at 15:28 Comment(0)
F
0

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

Frankfrankalmoign answered 16/8, 2017 at 16:48 Comment(0)
W
0

just do pip uninstall haystack and

pip install django-haystack
Whitefaced answered 22/9, 2017 at 6:13 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.