The required SCRIPT_NAME fixup and how to do it for that style of redirect is documented at:
http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive It is towards the end of that section. Graham On Tuesday, December 14, 2010 9:10:44 PM UTC+11, drx wrote: > > Dear List, > > I am running an Apache 2.2 with mod_wsgi, with several users, each doing > their > own webpy apps. > > Each user has a similar Apache .htaccess conf in their ~/public_html > directory, > this is mine: > > --- > <Files code.py> > SetHandler wsgi-script > Options ExecCGI FollowSymLinks > </Files> > > RedirectMatch permanent ^(.+)\.app$ $1.app/ > > RewriteEngine On > RewriteBase /~dragan.espenschied/ > RewriteRule ^(.+)\.app/static(.*)$ $1/static$2 [L] > RewriteRule ^(.+)\.app/(.*)$ $1/code.py/$2 > --- > > It makes that if you call a URI like /~dragan.espenschied/woot.app/ it will > run > /~dragan.espenschied/woot/code.py ... if you don't use the "app" extension, > you > get the usual directory listing. > > Now there are several issues with mod_wsgi, like webpy not being able to > figure > out on its own where its base directory is. That can be avoided, but the > main > issue is concerning redirects. > > If I do a > > --- > raise web.seeother('wherever') > --- > > the browser gets redirected to an URI like > /~dragan.espenschied/woot/code.py/wherever instead of > /~dragan.espenschied/woot.app/wherever > > I figured out that web.seeother is using an environment variable to prepend > the > base URI to a redirect. However, if I change this environment variable like > this > > --- > os.environ['REAL_SCRIPT_NAME'] = '/~dragan.espenschied/woot.app' > -- > > All other webpy apps running on the same server do redirects to my app's > URI > instead to their's. > > What would be a possible way to make the redirects work for multiple users > and > apps on the same server? Is there a better way to tell webpy the base URI > of the > app? > > Running another web server software is not an option, it is a managed > university > system with automatic updates etc (debian). > > > Another issue is the cookies. As already pointed out by some posters here, > the > cookies do not take any path into account. So everybody is reading > everybody > else's cookies. I suggest that webpy should, upon construction, accept a > base > URI parameter, because the automatics don't seem to work under all > conditions. > If there is no base URI parameter present, it could try doing the > automatics as > is. I consider it a bug that webpy seems to assume it is the only app > running on > a system. > > Thanks in advance for any ideas on this, > Dragan > > -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to we...@googlegroups.com. To unsubscribe from this group, send email to webpy+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.