I have found cron to be a poor solution for this although it is tempting since it is so easy and will get you started right away. What I observe happens is, basically someone puts the cron job in crontab, and then a lot of time passes, and folks forget which machine in the cluster is actually in charge of the cron job. Eventually that machine gets rebuilt or re-deployed, and then folks wonder why stuff mysteriously stops working. This has happened at least 3 times over the years at different places I have worked at. (I'm a site reliability engineer).
Cron is a fine solution, but it's such a single-point solution that it is fragile over time because folks forget about it, and it has a single point of failure. my 2 cents. Brian 2010/10/13 Ethan Poole <et...@lowter.us> > Another technique, that I feel should be pointed out, is a custom > django-admin command: > http://docs.djangoproject.com/en/dev/howto/custom-management-commands/. > If you are going to use a crontab to run a Python script, this is by > far the easiest way to do it. > > On 13 Okt, 10:53, ringemup <ringe...@gmail.com> wrote: > > 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<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.