我已经阅读了这两个构建搜索应用程序的教程。
但是当我谈到:
配置django-haystack,根据文档设置搜索索引类
http://docs.haystacksearch.org/dev/tutorial.html#configuration
将所需的 solr 字段添加到 settings.py(solr 服务器位置)
我收到此错误(尝试导入 haystack 时):
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中导入haystack,错误:
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
更新:
如果你在导入 haystack 的时候遇到这样的错误:
ImportError: Settings cannot be imported, because environment variable
DJANGO_SETTINGS_MODULE is undefined.
尝试在您的项目中导入./manage.py shell
而不是import haystack
.