I would think a lot about using Celery. It is not as difficult as it seems, and is an excellent tool for performing arbitrary asynchronous tasks. However, there is an easy way to do background emails using Django and the standard cron job.
First create a Django model to preserve emails you send.
class EmailsToSend(models.Model): email = models.Email... . . .
Then create a Django admin command to send unsent emails. See the Django documentation for details on how to do this. This code gives you the basic idea.
class Command(BaseCommand): def handle(self, *args, **options): emails = EmailsToSend.objects.all() for email in emails: send_my_email(email) email.delete()
You can then schedule this command using the cron job. However, I personally would prefer to use celery or something similar. This is a bit more work, but pays off in the long run.
source share