Updating a Haystack search index with Django + Celery

前端 未结 4 519
醉梦人生
醉梦人生 2021-01-30 22:27

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

4条回答
  •  孤独总比滥情好
    2021-01-30 22:42

    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()
    

提交回复
热议问题