I've got a Django app running under Apache2 (linux) using mod_wsgi and file uploads fail when running in daemon mode but works when the python interpreter is embedded. Any idea what could be causing this and how I fix it?
The following Apache configuration is working:
<VirtualHost *:80>
ServerName mysite.com
DocumentRoot /var/www/
Alias /media/ /var/www/media/
<Directory /var/www/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
Include /etc/apache2/yslow_optimizations.conf
</Directory>
WSGIScriptAlias / /var/djangoapp/apache/django.wsgi
<Directory /var/djangoapp/apache/>
Order allow,deny
Allow from all
</Directory>
ErrorLog /var/log/apache2/mysite.error.log
CustomLog /var/log/apache2/mysite.access.log combined
</VirtualHost>
But when I add the following directives to daemonize the wsgi process, the file upload instantly fails.
WSGIDaemonProcess mygroup display-name=%{GROUP} inactivity-timeout=600
WSGIProcessGroup mygroup
There doesn't appear to be anything in the Apache error log.
The Django form is using a FileField and just gives a "this field is required" error when doing the form.is_valid(). The view has a @login_required decorator. All of this is working fine when running in embedded mode.
Running as a daemon allows updating the code much more gracefully (by just touching the wsgi file) than when embedded which requires an Apache reload, so I'd much prefer that if it's possible.
Update: This occurs with Opera, not with FireFox.
At a guess, you are not running latest mod_wsgi 2.X version and are using Opera browser.
There is a known issue with Opera and its use of HTTP 100-continue when using mod_wsgi daemon mode. This issue was fixed in mod_wsgi 2.4.
Since though you don't say what version of mod_wsgi you are using, nor which browser you are using, this is only a guess.