I have to implement task on schedule , for that i am using django_cron. In setting :
INSTALLED_APPS = [
'mailsnake',
'corsheaders',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'Avaana_web',
'rest_framework',
'rest_framework.authtoken',
'django_cron',
]
and cron.py
from django_cron import CronJobBase, Schedule,cronScheduler
import datetime,os
class MyCronJob(CronJobBase):
RUN_EVERY_MINS = .3
RETRY_AFTER_FAILURE_MINS = 5
ALLOW_PARALLEL_RUNS = True
schedule = Schedule(run_every_mins=RUN_EVERY_MINS,
retry_after_failure_mins=RETRY_AFTER_FAILURE_MINS)
code = 'my_app.my_cron_job'
def do(self):
print("hello")
but when i run
$ python manage.py runcrons
hello
Only once output shows and ends.
How i can get output after every 30 seconds.