5

A normal approach to cron jobs with a django site would be to use cron to run custom management commands periodically.

But I found this http://code.google.com/p/django-cron/

How does it work, without needing cron? What invokes it to poll?

If it just sets up an address for an http request to hit periodically, what if the job takes a long time, won't the server time out?

mariodev
  • 13,928
  • 3
  • 49
  • 61
Eric
  • 1,093
  • 1
  • 9
  • 21
  • The next answer could be useful if you are insterested in django-cron: http://stackoverflow.com/questions/7127758/django-getting-django-cron-running/8392257#8392257 – sergzach Dec 10 '11 at 18:58

2 Answers2

6

It continually fires off a Timer thread, whose whole purpose is to wait a defined amount of time (the polling frequency you set in settings.py) and then run the execute on the django-cron queue again.

Chris Pratt
  • 232,153
  • 36
  • 385
  • 444
4

It depends on Django being a long-lived process, which if configured correctly it is. It runs a thread to check every 5 minutes (by default) to see if there are any jobs that need to be run, and if so runs them.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358