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. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.