Scheduling websolr reindexing using heroku scheduler

95 Views Asked by At

I have a scheduled command in Heroku's Schedule app that is meant to rebuild websolr indexes.

heroku run python manage.py rebuild_index

The thing is that the command required input from the user so it never runs successfully automatically.

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]

Is there any other way to rebuild my indexes using the Heroku Scheduler app or is there a way to automatically signal 'y' in the command so that the index is periodically built with my command in scheduler?

2

There are 2 best solutions below

0
Tikue Anazodo On

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' 
0
Jon Ekdahl On

You can pass the --noinput argument to the rebuild command, like this:

heroku run python manage.py rebuild_index --noinput

See Haystack management command documentation for more options.