Am 19.12.2010 03:59, schrieb Graham Dumpleton: > > > On Saturday, December 18, 2010 10:56:36 PM UTC+11, drx wrote: > > Thanks Graham! > > Tho I have issues understanding what these instructions give me. > > My problem is that there are multiple apps running on the > same apache server, on > the same virtual host. In all of the it is desired that > "code.py" is not present > in the URL. > > I figured from reading the source that webpy is using > os.environ['REAL_SCRIPT_NAME'] to construct redirect URIs. > > So i just put > > os.environ['REAL_SCRIPT_NAME'] = > '/~dragan.espenschied/whatever.app' > > in my code.py at the top. Other code.pys of other apps > contain lines with > corresponding URI paths. > > But this seems to affect other webpy apps running on the > same apache. If one of > these app is called, it constructs redirects to OTHER apps' > base URIs, what ever > seems to have been accessed before by any other user. > > > The fix from > > http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive > > <http://code.google.com/p/modwsgi/wiki/ConfigurationGuidelines#The_Apache_Alias_Directive> > suggest to change the environment variables as well: > > def application(environ, start_response): > # Wrapper to set SCRIPT_NAME to actual mount point. > environ['SCRIPT_NAME'] = > posixpath.dirname(environ['SCRIPT_NAME']) > if environ['SCRIPT_NAME'] == '/': > environ['SCRIPT_NAME'] = '' > return _application(environ, start_response) > > So what is the difference to just changing it in the > application code? Will this > not mix up the environment for other apps as well? > > And how did you actually incorporate this into your WSGI script > file? > > Please post examples of your WSGI script files. > > Also post more complete example of any Apache configuration > related to mod_wsgi. That is, are you using > WSGIDaemonProcess/WSGIProcessGroup/WSGIApplication group directives. > > You will get pollution between applications where they are > running in same process when using > os.environ['FORCE_SCRIPT_NAME'], because that is a process wide > environment variable. See: > > > http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Application_Environment_Variables > > This will cause problems with your setup as I understand it at > present. > > Graham
Hi Graham, sorry for the late reply. I cannot give all the details about the server setup, because it is a machine administrated by the university; it is also unpractical for the admins to move away from the debian defaults. So, to make it short, whatever `apt-get install libapache2-modwsgi` did, is running :) To make it useable for my side -- which is teaching students how to use python on the web -- i decided to work with the simple CGI and mod_rewrite. It solved all of my problems. Like this, web.py is a great framework for teaching, because in the end people write only python. The only thing I don't like now is the sessions not working while debugging is switched on and the session cookie not using paths, but the server root. Anyway i am glad to have made the move to web.py. drx -- You received this message because you are subscribed to the Google Groups "web.py" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/webpy?hl=en.
