用Django + Celery更新干草堆搜索索引 [英] Updating a Haystack search index with Django + Celery
问题描述
/manage.py update_index
这是从Haystack文档更新索引的命令,但我不知道如何从任务中调用该索引。
最简单的方法可能是直接从python运行管理命令,并在你的任务中运行
from haystack.management.commands import update_index
update_index.Command()。handle()
Excuse me if this is a basic question but I searched and couldn't find anything on this. In my Django project I am using Celery. I switched over a command from crontab to be a periodic task and it works well but it is just calling a method on a model. Is it possible to update my Haystack index from a periodic task as well? Has anyone done this?
/manage.py update_index
That's the command to update the index from the Haystack documentation but I'm not sure how to call that from a task.
the easiest way to do this would probably be to run the management command directly from python and run it in your task
from haystack.management.commands import update_index
update_index.Command().handle()
这篇关于用Django + Celery更新干草堆搜索索引的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!