安装 django-haystack

发布于 2024-11-01 21:13:15 字数 788 浏览 1 评论 0原文

超级简单的问题:我浏览了 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(7

尬尬 2024-11-08 21:13:15

您是否安装了错误的东西?这件事(尴尬地)就在今天发生在我身上。确保安装“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').

遗忘曾经 2024-11-08 21:13:15
  1. 你的Python路径中有haystack的路径吗? (PYTHONPATH shell 变量或 sys.path Python 列表。)

  2. 您运行了 python manage.pysyncdb 吗? p>

  3. python manage.py shell 后跟 import haystack 有效吗?

  4. import haystack之后,您会得到什么haystack.__version__

  5. 在同一 shell 中,键入以下内容。您是否收到其中任何错误?

    • haystack.management.commands
    • haystack.management.commands.rebuild_index
    • haystack.management.commands.rebuild_index.Command.help
  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
尐偏执 2024-11-08 21:13:15

我遇到了与您相同的错误,并通过删除旧的 .egg 并直接从最新版本安装来修复它。您可以使用 easy_install:

easy_install https://github.com/toastdriven/django-haystack/zipball/v1.2.4

希望这有帮助!

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!

一杯敬自由 2024-11-08 21:13:15

我遇到了同样的问题 - 无论出于何种原因,pip 中的 haystack 版本都相当旧且过时(截至今天为 v 0.6)。要使用 django-haystack,请查看 v1.1 版本。 来源

它可以简单地编译和安装

python setup.py build
python setup.py install

希望有帮助!

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!

邮友 2024-11-08 21:13:15

我只是遇到了同样的问题,并且没有在我的 settings.py 中设置 HAYSTACK_SITECONF 。

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

花桑 2024-11-08 21:13:15

尝试使用 ./manage.pyrebuild_index 而不是使用 python manage.pyrebuild_index

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

硪扪都還晓 2024-11-08 21:13:15

就做
pip uninstall haystack

pip install django-haystack

just do
pip uninstall haystack and

pip install django-haystack
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文