我在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‘的信号,以便在Scheduler中使用我的命令定期构建索引?
发布于 2014-09-05 15:13:55
找到了答案,添加'yes‘命令就完成了http://en.wikipedia.org/wiki/Yes_(Unix)操作
heroku run 'yes | python manage.py rebuild_index' 发布于 2015-09-29 02:03:48
您可以将--noinput参数传递给rebuild命令,如下所示:
python heroku运行python manage.py rebuild_index --noinput
有关更多选项,请参阅Haystack management command documentation。
https://stackoverflow.com/questions/25677976
复制相似问题