Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

3 Answers 3

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

share|improve this answer
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 '09 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 '09 at 15:04

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.

share|improve this answer

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.