The problem seems to be in serializing the sessions and I suspect the two virtual hosts confuse mod_wsgi about the web2py location. Perhaps this is because they have different DocumentRoot and none of them is what it should be. Try use the examples listed here:
http://web2py.com/book/default/chapter/11#mod_wsgi http://web2py.com/book/default/chapter/11#mod_wsgi-and-SSL On Dec 2, 4:38 pm, azarkowsky <[email protected]> wrote: > Hi, > > I'm running Web2py version 1.89.1 and attempting to set up a > production enviornment (Windows Server 2008) on our Intranet running > behind Apache with mod_wsgi & mod_auth_sspi (for grabbing the current > Windows username). Since this is an Intranet application only, I'd > like to have access to both the admin site & my web2py application. > > My goal is to be able to have 2 entry points: > App 1) http://<server>/<appname> - For normal users to access the > web2py app we built > App 2) https://<server>/admin (SSL) - For developers to access the > web2py admin interface at https://<server>/admin/default/site > > With my current apache confirguation, when I first start apache I can > access https://<server>/admin just fine, however if I then switch to > http://<server>/<appname>, web2py issues the following ticket: > > Traceback (most recent call last): > File "C:\aproj\web2py\gluon\main.py", line 453, in wsgibase > session._try_store_on_disk(request, response) > File "C:\aproj\web2py\gluon\globals.py", line 382, in > _try_store_on_disk > cPickle.dump(dict(self), response.session_file) > File "C:/python\lib\copy_reg.py", line 74, in _reduce_ex > getstate = self.__getstate__ > File "C:\aproj\web2py\gluon\sql.py", line 740, in __getattr__ > return dict.__getitem__(self,key) > KeyError: '__getstate__' > > At this point I can revisit https://<server>/admin and it comes up > fine just as it did before. If I restart Apache and revese the order > (access non-SSL first), our custom app comes up just fine, but then > the admin app will exhibit the same behavior and issue a ticket. > Basically, once I start Apache I seem to have to stay on either SSL or > Non-SSL, but can't switch between both -- the second app to be > accessed with always issue a ticket. Is it possible to use Apache > VirtualHosts to access both the admin site and non-admin site using > mod_wsgi or would I also need something like mod_rewrite or to handle > this via routes.py? I'd like to avoid installing Web2py as a Windows > service just for the ability to access the admin site if possible. > > Here are the relevant portions of my httpd.conf: > WSGIPythonHome "C:/python" > > NameVirtualHost *:80 > <VirtualHost *:80> > DocumentRoot "C:/aproj/web2py/applications" > ServerName server1 > > <Directory "C:/aproj/web2py"> > Order allow,deny > Deny from all > </Directory> > > <Location "/"> > Order allow,deny > Allow from all > > AuthName "Stadion Lunch Application" > AuthType SSPI > SSPIAuth On > SSPIAuthoritative On > SSPIDomain hq.ft > SSPIOmitDomain On > SSPIOfferBasic Off > SSPIBasicPreferred Off > SSPIUsernameCase lower > SSPIPerRequestAuth On > > Require group "HQ\IT" > #require valid-user > > </Location> > > <LocationMatch "^(/[\w_]*/static/.*)"> > Order Allow,Deny > Allow from all > </LocationMatch> > > WSGIScriptAlias / "C:/aproj/web2py/wsgihandler.py" > </VirtualHost> > > NameVirtualHost *:443 > <VirtualHost *:443> > DocumentRoot "C:/aproj/web2py/applications/admin" > ServerName server1admin > > <Directory "C:/aproj/web2py"> > Order allow,deny > Deny from all > </Directory> > > <Location "/"> > Order allow,deny > Allow from all > > AuthName "Stadion Lunch Application" > AuthType SSPI > SSPIAuth On > SSPIAuthoritative On > SSPIDomain hq.ft > SSPIOfferBasic Off > SSPIOmitDomain On > SSPIBasicPreferred Off > SSPIUsernameCase lower > SSPIPerRequestAuth On > > Require group "HQ\IT" > #require valid-user > > </Location> > > WSGIScriptAlias / "C:/aproj/web2py/wsgihandler.py" > > SSLEngine On > SSLCertificateFile conf/server.crt > SSLCertificateKeyFile conf/server.key > </VirtualHost> > > Any help would greatly be appreciated! > > Thanks, > Adam

