Django Schedule task at particular time periodically from user's order in app (without celery)
I am creating a Django App where the user can schedule some tasks to happen at a particular time.
for example. in google calendar we tell google what we will be doing tomorrow and then at right time it sends us a notification.
similarly here I want it to be flexible, for instance, the user can tell Django the time and function to run.
Django will wait for the time and then run the function.
like he said turn off lights at 12 pm
then Django will do it.
or for example:-
user says remind me to go to gym in 30 minutes
And then after 30 minutes he gets notification.
Actually the tasks are added dynamically so cant hardcode them at first.
(only Django method without celery or something will be appretiated)
Thanks!
Without Celery and using Django the best way to do is to create custom django-admin commands with Cron
For example :
- Create customer command called calendar_routine.py
- Create a cron schedule to call your function from your server at a given time
Otherwise there is no way to do it in pure Python/Django