A
A
awd102017-03-05 19:45:45
Django
awd10, 2017-03-05 19:45:45

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)

5. In settings.py added:
CRON_CLASSES = [
    "app.cron.EmailUsercountCronJob",
]

6. Launched runcrons
7. A log appeared in the database
791663906bdb4dbc9d293de327ec4f65.PNG
and manage.py issued the following:
runcrons C:/untitled
Test
Process finished with exit code 0

This is where the action ended. Cron does not work, the loop does not continue

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-03-05
@awd10

krona on Windows no
Put in a virtual machine with Linux

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question