Wednesday, October 13, 2010

Re: What is the best way to implement time-based / cronjob actions in a Django app?

On 13 ต.ค. 2010, at 18:38, Mattias Linnap wrote:

> Hi Django users,
>
> I'm building an application with Django, and I need some database
> changes to occur at certain times in the future - independently of any
> web request. Things like cleaning up expired sessions, deleting
> expired user actions, etc.
>
> What is the best way to implement those?

I had need for scheduled events separate from any HTTP requests. I recommend you check out django-command-extensions aka django-extensions, http://code.google.com/p/django-command-extensions/

It has a jobs system that lets you do cron stuff from within the Django paradigm. It's not a perfect match for your needs because it doesn't natively provide a way to schedule a job for a given time period from now, but you could schedule something every 5 or 15 mins and give users that many minutes grace past their official two hours...

Hope that helps,
Jonathan

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment