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
Passed $7k 💵 in a month with my boring directory of job boards 33 comments Reaching $100k MRR Organically in 12 months 29 comments 87.7% of entrepreneurs struggle with at least one mental health issue 14 comments How to Secure #1 on Product Hunt: DO’s and DON'Ts / Experience from PitchBob – AI Pitch Deck Generator & Founders Co-Pilot 11 comments Competing with a substitute? 📌 Here are 4 ad examples you can use [from TOP to BOTTOM of funnel] 10 comments Are you wondering how to gain subscribers to a founder's X account from scratch? 9 comments