4

I have a Django website, and I want to have a certain piece of Python code run at regular intervals. What would be a good way to do that?

I know I can cron, but I would prefer the solution to be within Django.

I know there's a module called celery which is supposed to do it, but it requires installing RabbitMQ and configuring it to interact with Apache, which is another thing to maintain, and I prefer to avoid that.

Any suggestions?

0

3 Answers 3

3

Take a look at Chronograph. You may also want to look at the command-extensions and this Stack Overflow question.

2
  • 1
    It looks okay, but then I would still have to use cron. Isn't there a way to avoid cron completely?
    – Ram Rachum
    Oct 9, 2009 at 14:15
  • There probably are a lot of ways to avoid cron, but it's the built-in, tried-and-true way of scheduling tasks in Unix. Do you need to avoid it because of permissions? If not, I think this is the least painful solution. One cron job and then you can do everything via Django. If you want to be able to run scheduled processes, you're going to need something that runs every x time periods to do it and no matter what you cobble together, cron will be at the base of it. It's turtles all the way down.
    – Tom
    Oct 9, 2009 at 15:04
0

Celery supporting periodic tasks is more like a side-effect really. If you don't need the asynchronous part, it's probably overkill for you. However, if you already depend on it, the periodic tasks are a great addition, and the way it's scheduling actions is very helpful for quite a lot of asynchronous patterns as well. The feature that celery has that cron doesn't (AFAIK), is that it's able to distribute the periodic jobs over multiple servers. Which again, might just be overkill for you.

0

You can try Celery: Distributed Task Queue

http://www.celeryproject.org/

We use this to offload non-realtime tasks but need to be executed immediately, like sending conformation mail to user at http://www.allthingscustomized.com/

Try it out

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .