You can also use this technique[1] to create a python script that you can call from your crontab. Basically, you can call anything in Django from any Python script as long as you set the DJANGO_SETTINGS_MODULE environment variable first and have Django, your project, and your apps on your path.
[1] http://www.nerdydork.com/django-cron-on-webfaction.html On Oct 13, 10:47 am, Jo <reduxion...@me.com> wrote: > On 13 ต.ค. 2010, at 18:50, Jonathan Barratt wrote: > > > 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? > > Having now checked it out for use in my own project, the '"Celery" suggestion > that's been made to you definitely sounds like the most 'correct' way to > implement this. Thanks Tom and Brian! > > It is, however, as Tom admitted, rather complex. I had another idea that I > figured was worth throwing out there for your consideration as it's a lot > easier and faster to implement, though correspondingly not nearly as flexible > or powerful: just use the *nix command "at." When someone reserves an item > just execute something along the lines of: (os.popen.) popen('echo "COMMAND > "' + PARAMETERS + ' | at now + 2 hours' > > This is nowhere near as robust or efficient as I'm sure Celery is, but it's > so much simpler and quicker that I thought it worth mentioning in case you > don't have the time to get Celery going right away and need something to use > for demo\testing purposes in the meantime... > > Just a thought, > 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-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.