[Web-SIG] A query for hosting providers

Ian Bicking ianb at colorstudy.com
Fri Apr 1 20:24:24 CEST 2005


Titus Brown wrote:
> -> I use relative URLs because of this, but I understand why this might
> -> cause you problems.  Perhaps we can add a 'root namespace' parameter
> -> to WSGI...
> 
> duh.
> 
> That's what SCRIPT_NAME is.

BTW, an interesting (I think) pattern that I found, with a hook I added 
  to wsgikit.urlparser which calls __init__.urlparser_hook(environ) when 
it's parsing the URL.  In the root of an "application", I do something like:

def urlparser_hook(environ):
     if 'todo.base_url' not in environ:
         environ['todo.base_url'] = environ['SCRIPT_NAME']

This way as urlparser continues its parsing I keep a kind of bookmark to 
the state of SCRIPT_NAME.

-- 
Ian Bicking  /  ianb at colorstudy.com  /  http://blog.ianbicking.org


More information about the Web-SIG mailing list