*Implementing schedule task *
Note!!!!
1.You can't test this locally in Windows.
2.Don't forget to create the env file.
step 1:
FIRST install the django-crontab
pip install django-crontab
And the create a function what you want to run.
def my_schedule():
pass
step 2:
Add it to your settings.py
NSTALLED_APPS = (
'django_crontab',
)
If you want to change the time please check the (crontab guru ) website
example:
CRONJOBS = [
('* * * * *', 'user.views.my_schedule')
]
step 3
And finally run this command
python manage.py crontab add
Happy code
Top comments (0)