Hello,
I have Django running under apache2 (the worker version, I believe,
with MaxRequestsPerChild set to the default, which is 0). I am using
mod_wsgi in daemon mode. I have checked that it is daemon mode using
the method described on mod_wsgi's ReloadingSourceCode page.
I need to do a nightly refresh because I get data for the db from a
coworker somewhere else. So I have a cron job that does as follows.
(1) Sets a flag "SITE_UP=False" in the code base file "site_up.py"
that shows up in each RequestContext, causing each dynamic page to say
"site is not up" since base.html looks for that flag {{SITE_UP}}.
(2) Touches django.wsgi so pages will tell visitors the site is not
up.
(3) Updates the dB
(4) Sets the flag from (1) back to its starting value
"SITE_UP=True".
(5) Touches django.wsgi.
(Step (3) takes perhaps a half hour. If there is a better way to do
what I am trying to do, I'd be very glad to hear it.)
The problem is: I come in the next morning and sometimes the pages
work, while sometimes they say "Site is no up".
If I keep refreshing a page in my browser then sometimes it works
correctly and gives me the new data, and sometimes it says "not up."
If I restart apache, the problem of showing "not up" disappears.
I had thought that Apache's children talk to the wsgi processes (I
have 4 of them), which mod_wsgi's ReloadingSourceCode page tells me
will be restarted. But obviously I'm not understanding something.
I wonder if anyone has a suggestion about how I am going wrong? I was
hopeful of finding a way to accomplish this without having to restart
apache from a cron job.
Thank you,
Jim
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.