Update django database automatically with schedule


I am working on a Django project to track my daily tasks.
I hope my database can automatically create a new record as "unfinished" at midnight each day. How can I implement this feature in Django + React?


2 Options came to my mind:

1- Use management command and cron:

Read about management command in https://docs.djangoproject.com/en/3.2/howto/custom-management-commands/#howto-custom-management-commands :

python manage.py YOUR_COMMAND

Then use cron in linux for setting scheduled task

2- Use celery

Read docs for using: https://docs.celeryproject.org/en/latest/userguide/periodic-tasks.html

Answered By – Amin

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published