I use Apache in Embedded mode as my production server.
whenever I make some modifications to my django core files (urls.py, settings.py, views.py, etc), I simply touch project.wsgi file and changes appear on the webpage instantly. Sometimes it works.
However sometimes it doesn’t. Apache just hangs. It cannot serve requests and needs a restart (giving the users for 1-2 seconds an “Internal Server Error” message). Then I need to restart (restart, actually doesn’t work too. It needs to stop and start again).
I am pasting some code from my httpd.conf
MaxSpareThreads 3
MinSpareThreads 1
ServerLimit 1
SetEnvIf X-Forwarded-SSL on HTTPS=1
ThreadsPerChild 5
WSGIDaemonProcess myproject processes=4 threads=12 python-path=[...]
WSGIProcessGroup myproject
WSGIRestrictEmbedded On
Why is that? Is it because Apache sometime it uses all processes at the same time and cannot reload core files? (this is what ‘touch’ should do, right?)
EDIT: I am sorry. Apache runs in embedded mode. My mistake. I updated the question.
EDIT2: Included WSGIProcessGroup line
Touching the WSGI script file doesn’t do anything in embedded mode, so not surprising it doesn’t work all the time. When it appears to, it is just that the request got handled by a new Apache process that hadn’t handled requests before.
For touching the WSGI script file to work you need to use daemon mode. Your configuration is half broken though. You have define WSGIDaemonProcess for daemon mode, but then aren’t delegating the application to run under that daemon process group using WSGIProcessGroup.
Go read:
http://code.google.com/p/modwsgi/wiki/ReloadingSourceCode
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process