I've got a django 1.1 website I want to run in wsgi (as that seems to be the recommended deployment on apache). I want it to run as the www user (apache is running as www-data). I would ideally like this to work out of http://hostname/~www/ (~www/public_html) as well as http://virtualhostname/. I also want this to work for other users who may later use wsgi. Can I make this happen? I've been staring at docs trying to figure where to start, but I'm having trouble combining userdir and wsgi to let me run ~xxx/public_html/index.wsgi as user xxx, for every user xxx.
For starters look at mod_wsgi daemon mode. That allows you to delegate WSGI applications to run in distinct daemon processes. Those processes can then be made to run as a specified user with no need to be using suxec. See:
http://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process
For running out of a UserDir configured directory with the user having control of where applications are mounted you cant used WSGIScriptAlias and instead need to use AddHandler method for setting up mod_wsgi. See:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive
The UserDir directive implicitly supplies the Alias directive so you should only need to worry about the AddHandler directive etc.
Do note however that because of precedence rules in Apache, you likely cannot use WSGIScriptAlias at '/' for the same overall virtual host as may mask the user directories. Just means you need to rely on the AddHandler, with mod_rewrite fixup, if mounting on root of site as described in latter part of that section of the documentation.
Suggest you use the official mod_wsgi mailing list for more detail.
My specific problem was solved in the following way:
In the VirtualHost block:
In userdir.conf:
In ~www/public_html/.htaccess
And some stuff I didn't really need:
dir.conf:
wsgi.conf