On Mar 25, 11:53 am, Malcolm Tredinnick <malc...@pointy-stick.com>
wrote:
> On Tue, 2009-03-24 at 14:59 -0700, JGAllen23 wrote:
> > Is there any way to call a function on server start?  I have some
> > maintenance stuff that I'd like to run on server start (both manage.py
> > runserver and apache reload).  Is there any way to do that?
>
> No, because the requirement doesn't make sense. Processes are stopped
> and started *frequently* during the running of a website. A web server
> like Apache kills child processes after a certain number of requests (to
> control memory usage, etc) and starts new ones. You'll see thousands of
> stops and starts over the course of a week.
>
> You shouldn't use something designed for a "shared nothing" setup, such
> as Django, to try and influence things like that, since the lifecycles
> are completely mismatched.

With Apache, also need to take into consideration that it is a
multiprocess web server. Thus, even if you use features of mod_python
or mod_wsgi to perform some action when a worker process first starts,
that same action might be triggered in multiple processes at the same
time. You therefore have to deal with contention issues if they are
trying to operate on the same thing.

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

Reply via email to