问题
I sent mail an hour before the event (the model in django), checked the date check in shell, but celery does not send any mail or print to the console. I have a feeling that I didn't finish writing something, because I haven't worked with the planned actions yet. but there are no ideas. I didn't connect it anywhere shedule.py perhaps this is the reason
tasks.py:
@shared_task
def event_send_mail():
events = Event.objects.filter(event_date=datetime.now() + timedelta(minutes=60))
for event in events:
print("Событие")
send_mail("Напоминание о событии", str(event.title) + "начинаеся через час",
"marsel.abdullin.00@mail.ru", [event.user.email, ])
shedule.py:
CELERYBEAT_SCHEDULE = {
'send_mail': {
'task': 'tasks.event_send_mail',
'schedule': timedelta(minutes=1),
},
}
settings.py:
CELERYBEAT_SCHEDULER = "djcelery.schedulers.DatabaseScheduler"
来源:https://stackoverflow.com/questions/62801096/why-doesnt-celery-send-an-email-at-the-specified-time