Answer the question
In order to leave comments, you need to log in
How to befriend django + cron?
I hope with your help to understand what I'm doing wrong.
1. Installed django_cron
2. Added it to installed applications.
3. I applied the migration, the django_cron_cronjoblog table was created
4. In the empty body of the empty application, I created the cron.py file with the following data (I took the blanks from here ):
from django_cron import CronJobBase, Schedule
class EmailUsercountCronJob(CronJobBase):
"""
Send an email with the user count.
"""
RUN_EVERY_MINS = 0
schedule = Schedule(run_every_mins=RUN_EVERY_MINS)
code = 'cron.EmailUsercountCronJob'
def do(self):
message = 'Test'
print(message)
CRON_CLASSES = [
"app.cron.EmailUsercountCronJob",
]
runcrons
runcrons C:/untitled
Test
Process finished with exit code 0
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question