pythondjangodjango-cron

Cron not doing my task without the command python manage.py runcrons


I managed to make a function that sends lots of emails to every user in my Django application, for that I used the django-cron package.

I need to send the emails in a particular hour of the day, so I added in my function the following:

RUN_AT_TIMES = ['14:00']

schedule = Schedule(run_at_times=RUN_AT_TIMES)

The problem is that this function is only called if I run the command:

python manage.py runcrons

What can I do to make the application work after one single call of the command python manage.py runcrons?

P.S.: I need this application to work in Heroku as well.


Solution

  • As described in the docs' installation guide at point 6, you need to set up a cron job to execute the command. The packages takes away the annoyance of setting up separate cron jobs for all your commands, but does not eliminate cron entirely.

    EDIT: after seeing your update, as I understand working with crons on heroku depends on plan (really not sure about that), but there are some apps that help with that. Heroku Scheduler for example.