0

我在 Heroku 的 Schedule 应用程序中有一个计划命令,用于重建 websolr 索引。

heroku run python manage.py rebuild_index

问题是该命令需要用户输入,因此它永远不会自动成功运行。

WARNING: This will irreparably remove EVERYTHING from your search index in connection 'default'.
Your choices after this are to restore from backups or rebuild via the `rebuild_index` command.
Are you sure you wish to continue? [y/N]

有没有其他方法可以使用 Heroku Scheduler 应用程序重建我的索引,或者有没有办法在命令中自动发出“y”信号,以便在调度程序中使用我的命令定期构建索引?

4

2 回答 2

0

Found the answer, adding the 'yes' command did the trick http://en.wikipedia.org/wiki/Yes_(Unix)

heroku run 'yes | python manage.py rebuild_index' 
于 2014-09-05T07:13:54.913 回答
0

您可以将--noinput参数传递给重建命令,如下所示:

heroku 运行 python manage.py rebuild_index --noinput

有关更多选项,请参阅Haystack 管理命令文档

于 2015-09-28T18:03:47.707 回答