[Web-SIG] Re: WSGI and Configuration

Ian Bicking ianb at colorstudy.com
Sun Nov 14 15:02:59 CET 2004


In this, I actually forget the use case that started me on this.

I want the configuration to be modifiable on a per-URL basis. 
Specifically, wsgikit.urlparser will look for a configuration file in 
each directory it visits ("web.ini" or something); each configuration 
file it finds will be nested, taking precendence but not entirely hiding 
previous configuration files.  In the simplest case, an application 
would simply be configured with a single .ini file in the root of the 
application.

Of course, there are problems with this.  Like, the server lives above 
urlparser, so it won't see what urlparser does, and it can't take 
configuration values from web.ini.

So really what I'm thinking about is something like .htaccess in Apache. 
  There's a bunch of values that urlparser will take, like extensions to 
display or hide, adding new handlers for extensions, maybe mime types, 
ways of folding two directories together, etc.  But I also want any 
application or middleware below urlparser to also be configurable. 
E.g., setting up a different email address for errors based on the path.

One possibility I've used before is just putting all this stuff in 
__init__.py, and maybe having urlparser look for a specially-named 
variable there.  This is good for some things.  But that can be 
confusing when there's both a Python data structure and a config file, 
since I don't want to use Python modules everywhere.

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


More information about the Web-SIG mailing list