我已阅读这两个教程,用于构建搜索应用程序。Ubuntu - Django Solr和Haystack集成错误
但是当我来到:
Configure django-haystack, set up the search index classes according to the docs
http://docs.haystacksearch.org/dev/tutorial.html#configuration
Add the required solr fields to settings.py (solr server location)
我得到这个错误(当试图导入干草堆时......)
raise ImproperlyConfigured("You must define the HAYSTACK_SITECONF setting before using
the search framework.")
django.core.exceptions.ImproperlyConfigured: You must define the HAYSTACK_SITECONF
setting before using the search framework.
在python错误导入干草堆:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.6/dist-packages/django_haystack-1.2.7-py2.6.egg/haystack
/__init__.py", line 26, in <module>
raise ImproperlyConfigured("You must define the HAYSTACK_SITECONF setting before
using the search framework.")
django.core.exceptions.ImproperlyConfigured: You must define the HAYSTACK_SITECONF
setting before using the search framework.
我已经安装了草堆与sudo easy_install https://github.com/toastdriven/django-haystack/zipball/v1.2.7
。
我的Django的版本:1.4
UPDATE:
,如果你有麻烦某事像这样的错误导入干草堆时:
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
尝试在你的项目中导入为./manage .py shell比进口干草堆....
你挂断了什么?您是否在settings.py中定义了'HAYSTACK_SITECONF'? – 2012-07-11 14:49:53
@chriss我没有定义HAYSTACK_SITECONF我已经定义HAYSTACK_CONNECTIONS,而是。因为安装Haystack 1.2.7。 – Aragon 2012-07-11 14:52:40
Haystack 1.2.7不使用'HAYSTACK_CONNECTIONS' - 即Haystack 2.0+。 Haystack文档默认为开发版本,而不是当前的PyPi版本。尽管如此,如果您想要走这条路线,Haystack 2.0是完全可用的。我自己使用它。你只需要从Github克隆它。 – 2012-07-11 14:59:05