Note that there are some explanatory texts on larger screens.

plurals
  1. PORestart deamon process for django under apache for each request
    primarykey
    data
    text
    <p>I have many django installation which must run under one URL only. So I have a structure like</p> <ol> <li>Django Installation 1</li> <li><p>Django Installation 2</p></li> <li><p>Django Installation N</p></li> </ol> <p>under my root directory.</p> <p>Now from the URL "www.mysite.com/installation1" I pick up subpart "installation1" and set the os.environ['DJANGO_SETTINGS_MODULE'] to "installation.settings" and let the request be handled. Now for the request "www.mysite.com/installation2" I must do the same. However since django caches site object, AppCache etc internally I must restart wsgi process before each request so that internal cache of django gets cleared. ( I know performance would not be good but Im not worried about that). To implement the above scenerio I have implemented the below solution:</p> <ol> <li>In httpd.conf as WSGIDaemonProcess django processes=5 threads=1</li> <li><p>In the django.core.handlers.wsgi I made the following change in def "<strong>call</strong>"</p> <pre><code>if environ['mod_wsgi.process_group'] != '': import signal, os print 'Sending the signal to kill the wsgi process' os.kill(os.getpid(), signal.SIGINT) return response </code></pre></li> </ol> <p>My assumption being that deamon process would be killed at each request after the response has been sent. I want to confirm this assumption that my process would only be killed only and only after my response has been sent.</p> <p>Also is there another way I can solve this problem</p> <p>Thanks</p> <p>EDIT: After the suggestion to set the MaxRequestsPerChild to 1 I made the following changes to httpd.conf</p> <p>KeepAlive Off<br> Listen 12021<br> MaxSpareThreads 1<br> MinSpareThreads 1<br> MaxRequestsPerChild 1<br> ServerLimit 1<br> SetEnvIf X-Forwarded-SSL on HTTPS=1<br> ThreadsPerChild 1<br> WSGIDaemonProcess django processes=5 threads=1<br></p> <p>But my process is not getting restarted at each request. once the process is started it keeps on processing the request. Am i missing something? </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload