Deciding among the most suitable options to run background tasks in Django for sending Emails.

Hi Everyone,

I was creating a project and needed to send scheduled(To be sent after a particular time. It can be months, years, or hours) emails. The approach I had in my mind was using something like a background task. I am using DRF+Next.JS.
Celery might be overkill for this task and I came to know about the Django-background-tasks package for this task. But, I am not sure if I am thinking the right way or not as I am not that experienced and just don’t want to put an extra load on my server.
Looking forward to your suggestions.
Would be really thankful if you guys can also leave some tips(Things to keep in mind) for choosing between different packages(May not be specific to this particular task), as per your experiences.

Thanks.

My opinion:
I always use celery for background tasks, it’s robust, it’s scalable, it’s not lightweight, the same way as django is not lightweight, but it’s great to develop, and great on production.
So if i had to pick one, i would pick celery instead of a random “lightweight” package.

1 Like

There have been multiple threads on this topic here. You may want to search for background tasks to find them. Briefly, use Celery.

1 Like

In my project I solved this with custom management command + CRON schedule and it works reliably for months. It is not totally flexible but was way easier to set up.

I have a short blog post about it too - Django: How to send email without Celery | Filip Němeček It got featured in Django News newsletter so I guess it is not totally crazy approach :smiley:

1 Like

Thank you so much for your valuable opinions. I will make sure to check out more about Celery.

Thanks a lot.
I will look into it :slightly_smiling_face:

Sure, I will.
Thank you.