You really should take a look at
django-celery<http://celeryq.org/docs/django-celery/getting-started/first-steps-with-django.html>.
 It is the right tool for this job IMHO.

Brian

On Wed, Oct 13, 2010 at 7:38 AM, Mattias Linnap <matt...@linnap.com> 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?
> 1) Make a special view, like /cron/, that performs all the scheduled
> actions, and use an external script to poll it over HTTP regularly.
> Cons: there might be a request timeout in the web server, so only a
> small number of very fast actions are possible.
> 2) Use standard linux cron, and write a script that calls ./manage.py
> with custom commands. Cons: is it a good idea to use manage.py
> commands in production?
> 3) Try to avoid any time-based database changes, and rewrite the app
> so that data objects know if they are "too old". Cons: makes the rest
> of the app more complex.
> 4) Something else?
>
> If a bit of background might be useful, I'm building an online sales
> app where users can reserve products for up to 2 hours. When the 2
> hours is over, the product is marked as available again. It would be
> possible to compute the availability of each product based on the list
> of reservations instead of caching it at the object, but this would
> require looking through all reservations and sales ever made to know
> the current state of a product.
>
> Thanks for any advice,
>
> Mattias
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>


-- 
Brian Bouterse
ITng Services

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

Reply via email to