My solution thanks to Graham:
<Location /dirname>
SSLVerifyClient none
SSLOptions +FakeBasicAuth
SSLRequireSSL
AuthName "name Authentication"
AuthType Basic
AuthUserFile /etc/httpd/stuff.passwd
require valid-user
RequestHeader set X-Url-Scheme https
</Location>
ProxyPass /dirname http://django.test/dirname
ProxyPassReverse /dirname http://django.test/dirname
On django.test I added this :
SetEnvIf X-Url-Scheme https HTTPS=1
after
WSGIScriptAlias /dirname /path_to_wsgi_script/django.wsgi
Ok, so once again we come down to user error. At some point the problem changed because I changed some of the code above, so that
def post_authentication_api(request):
became
def post_authentication_api(self, request):
this doesnt work because as Graham said at the django mailing list
"If you ... have a 'self' first argument for a function which
isn't a method of a class, it is obvious you are going to get:"
Exception Type: TypeError at /auth/post_authentication_api
Exception Value: post_authentication_api() takes exactly 2 arguments
(1 given)
So after I fixed that up I came to the root of the problem (as far as I can tell) which was that wsgi was blocking sys.stdout. which I think seems fair to me, and I had some print statements in my code and this is why it wasnt running. A very simple problem that for some reason became very complicated.
Anyway, Great thanks to Graham who has helped me out for the last week on this. He has been tireless and very accommodating to someone who is quite embarrassed about the final outcome. Some votes will be coming his way for the comments and my many thanks as well.
Thanks again
Mark
Best Answer
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.