I have my first django app deployed on heroku. Within this app I have an assortment of custom management commands that I would like to run periodically. For example I need one command to run once every two weeks, another to run every Sunday and Wednesday, and another to run once a week. I've read about a couple different options including celery, Heroku scheduler, and Cron. I'm unsure which solution to choose and why.
2 Answers
On Heroku, Cron and Heroku Scheduler are roughly the same thing.
Heroku Scheduler:
This is a beta feature for Heroku last I checked. It's not guaranteed to have 100% uptime. If you have paying customers and these periodic tasks are mission critical, you shouldn't rely on this. If you're looking for an free way to implement periodic tasks for something that's not too critical, then Heroku Scheduler will work for you.
Celery:
This is an asynchronous task library. It's very large and robust and can do just about anything you could want. The largest difference from Cron is that you can schedule an async task to run at any given time and aren't limited to only periodic tasks (things that run every X minutes/days, etc). That robustness comes at a cost though. It's more difficult to setup on production and locally. Especially locally. On production I'd recommend CloudAMQP for the broker and RedisCloud for the results. Only pass task parameters as primitives to avoid pickling and keeping the message size down.
If you need something reliable, but don't want to use Celery there's also RQ and Dramatiq.

- 13,493
- 2
- 32
- 34
Another option which might work for you is an Heroku add-on we've added recently, called Cron To Go. It's more reliable than Heroku Scheduler and more flexible because you can use any cron expression to schedule your background jobs. It'll probably be cheaper to use than Celery which requires you to have dynos on at all times, and easier to maintain as you don't have to push code changes every time you want to change a schedule.

- 1,158
- 9
- 12