安装 django-haystack
超级简单的问题:我浏览了 haystack 的“入门”文档(使用 whoosh;我使用 pip 安装了 python-whoosh 和 haystack (第一次使用它)),但我根本无法运行 python manage.py rebuild_index。我收到此错误:
python manage.py rebuild_index
Unknown command: 'rebuild_index'
Type 'manage.py help' for usage
我在 settings.py 的 INSTALLED_APPS 中确实列出了“haystack”,因此 此解决方案< /a> 似乎对我不起作用。当我运行“import haystack”时,我也没有收到导入错误,因此它确实存在。我在现有的项目以及专门为此制作的全新对象上尝试过此操作,但我无法让它工作。
但是,当我在 python manage.py shell
之后导入 haystack 并尝试 haystack.__version__
时,我得到“AttributeError: 'module' object has no attribute 'version”强>'"。如果我尝试 haystack.management,我会收到类似的错误:它没有管理属性。
这一定是我所缺少的超级简单的东西。感谢您阅读本文!
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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您是否安装了错误的东西?这件事(尴尬地)就在今天发生在我身上。确保安装“django-haystack”而不仅仅是“haystack”(并且您必须删除“haystack”,因为它与“django-haystack”冲突)。
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').
你的Python路径中有haystack的路径吗? (
PYTHONPATH
shell 变量或sys.path
Python 列表。)您运行了
python manage.pysyncdb
吗? p>python manage.py shell
后跟import haystack
有效吗?在
import haystack
之后,您会得到什么haystack.__version__
?在同一 shell 中,键入以下内容。您是否收到其中任何错误?
haystack.management.commands
haystack.management.commands.rebuild_index
haystack.management.commands.rebuild_index.Command.help
Do you have the path to haystack in your Python path? (Either the
PYTHONPATH
shell variable or thesys.path
Python list.)Did you run
python manage.py syncdb
?Does
python manage.py shell
followed byimport haystack
work?After
import haystack
, what do you get forhaystack.__version__
?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
我遇到了与您相同的错误,并通过删除旧的 .egg 并直接从最新版本安装来修复它。您可以使用 easy_install:
希望这有帮助!
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:
Hope this helps!
我遇到了同样的问题 - 无论出于何种原因,pip 中的 haystack 版本都相当旧且过时(截至今天为 v 0.6)。要使用 django-haystack,请查看 v1.1 版本。 来源。
它可以简单地编译和安装
希望有帮助!
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
Hope that helps!
我只是遇到了同样的问题,并且没有在我的 settings.py 中设置 HAYSTACK_SITECONF 。
I just had the same problem and hadn't set HAYSTACK_SITECONF in my settings.py.
尝试使用
./manage.pyrebuild_index
而不是使用python manage.pyrebuild_index
Instead of using
python manage.py rebuild_index
try using./manage.py rebuild_index
就做
pip uninstall haystack
和just do
pip uninstall haystack
and