[Web-SIG] WSGI deployment: an experiment

Ian Bicking ianb at colorstudy.com
Fri Jul 29 06:12:03 CEST 2005


On Jul 28, 2005, at 8:14 PM, Rene Dudfield wrote:
> There is a lot of terminology here that would not be understood by
> some random sys admin coming to have a look at the config file.

Yeah... I don't know.  I suppose if it looked like Apache it would feel 
more natural.  The "use" stuff is, IMHO, has simple as it can be made.  
The application configuration ("browse_path") is pretty much free-form. 
  So something like urlmap could have been like:

<Location "/home">
   Application FileBrowser app
</Location>

It's more special-case than I like, but maybe that's okay.  This would 
imply something ZConfig-based.  But still, there's no magic bullet for 
configuration, there's always something new to figure out, so IMHO the 
usability is more about error handling and the like.

> Below I pasted it here without the comments.  Sometimes it is good to
> have a look at things without comments to see how readable they are.
>
> Is this config file reusable?  Can I place it in a path of other apps,
> and then it could live in say /app2 instead of at / Can it not care
> about the server it is running on?

The application that this configuration file describes can be mounted 
anywhere; so you could reference it from another configuration file 
which put the whole batch at /app2.  What it doesn't do yet (but 
wouldn't be hard) would be something like:

   [application: urlmap]
   use: Paste urlmap
   /webmail: config_file.ini

Then that configuration file could in turn have another urlmap entry, 
dispatching to yet more applications.  urlmap incidentally supports 
virtual hosts as well as path dispatching, so you could do:

   http://foobar.com = foobar.ini

Well... that's where .ini syntax fails (the ":"), but we'll ignore 
that...


The server doesn't matter.  It just happens that the server and 
application configuration live in differently-named sections which 
don't clash, so they can go in the same configuration file.  You could 
have the files separate just as easily.  Not that my script supports 
that, but since it's a three-line frontend at this point...

> 
> [server:main]
> use: Paste wsgiutils
> port: 8080
> host: 127.0.0.1
>
> [application: main]
> use: Paste pipeline
> pipeline: printdebug urlmap
>
> [filter: printdebug]
> use: Paste printdebug
>
> [application: urlmap]
> use: Paste urlmap
> /home = fb1
> /other = fb2
>
> [application: fb1]
> use: FileBrowser app
> browse_path = /home/ianb
>
> [application: fb2]
> use: FileBrowser app
> browse_path = /home/rflosi

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



More information about the Web-SIG mailing list