2
3 Comments

Django Scheduled Tasks (One Time Run)

Hello,

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!!!

  1. 2

    I assume the homeworks could get assigned at any time so a 1 time run cant solve the problem. You should ideally have a scheduled job which runs say every 1 minute or 5 minutes to check if there are students whose threshold is about to be reached and trigger the email accordingly. You can use python RQ for this, its quite easy to learn and sufficient for your use case.

    http://python-rq.org/
    https://github.com/rq/django-rq

    A bit late but hope it helps or at least gives some hints.

    1. 1

      Hi @deepuj, what is the difference between that and Celery?

      1. 1

        Hi @Brauhaus . Yes celery is the more popular option for this but while researching the tool to use for a similar need of mine I came across RQ and the notion that is much simpler and easier to use. I have not even tried using Celery so cant comment but indeed found RQ very simple and easy to use, esp. the django-rq app makes life easy for newbie like me.

        Below is 1 of the articles that had influenced me.
        https://frappe.io/blog/technology/why-we-moved-from-celery-to-rq

Trending on Indie Hackers
I've built a 2300$ a month SaaS out of a simple problem. 19 comments 🔥 Roast My Landing Page 11 comments Where can I buy newsletter ad promos? 8 comments Key takeaways growing MRR from $6.5k to $20k for my design studio 6 comments How would you monetize my project colorsandfonts? 5 comments YouTube? How to start 5 comments