I am new to python and django. I had django running properly in my machine, till I installed django-haystack. I directly downloaded django-haystack.zip from github and executed 'python setup.py install' in haystack dir. After this whenever I run 'django-admin.py runserver' I am getting the following error : ImportError: cannot import name xrange.
If I remove 'haystack' from INSTALLED_APPS the above command is working fine.
I also cannot run 'python manage.py build_solr_schema' because of the same error. Let me know how I can resolve this issue.
Solved the issue. Deleted the haystack installation from /usr/local/.../dist-packages/ and used pip install django-haystack
to install. That worked fine
This:
http://pypi.python.org/pypi/haystack/
is not the same as this:
http://pypi.python.org/pypi/django-haystack
but if you have them both in your requirements.txt file for some reason, like so:
haystack
django-haystack
and install them into the same virtualenv then you will have problems because they both want to unpack to a directory named 'haystack'. 99% of the time if you're doing django development you don't want that first one at all. So remove it from the requirements.txt file, remove all traces of anything to do with haystack from your virtualenv and then reinstall with:
pip install -r requirements.txt
and you should be good to go.
if you have installed haystack and django-haystack, uninstall both haystacks and install django-haystack
pip uninstall haystack
pip uninstall django-haystack
pip install django-haystack
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With