Search code examples
djangodjango-celerydjango-cron

Scheduling Tasks in Django


I am new to Django. I built a program that lets teachers assign homework to students. The homework has a due date that is different for each student.

I want to make it so that 1 hour before the homework is due for that particular student, they get sent an email.

So, for example:

  • Student 1 with HW due at 3 pm would get an email at 2 pm
  • Student 2 with HW due at 1 am would get an email at 12 am

How can I achieve this? Thanks!!!


Solution

  • write a Django Management command which identifies students who need to be sent a reminder email and then sends emails. use cron job(crontab in Linux) to run this Django management command periodically (every hour or every minute)