[Web-SIG] Accessing deeply nested multiple doc roots for WSGI apps

Ben Bangert ben at groovie.org
Sat Oct 15 02:30:22 CEST 2005


As I'm working on some tools to facilitate the easy use and  
distribution of WSGI apps and middleware, a problem is starting to  
crop up. Most of these WSGI apps come with their own little set of  
static files (images, javascript, etc.) that need to be delivered  
should they be executed. Of course, Apache and such only allow for a  
single doc-root so I can't exactly through in each WSGI app's path to  
the static files.

These static paths are also very deep as the WSGI apps are installed  
as Python egg's. I've been using Ian's StaticURLParser from Python  
Paste, but its speed concerns me plus the fact that it means my  
webapp is essentially doing little more than relay filesystem data.

Several thoughts occur to me to deal with this:

1) Have a faster version of StaticURLParser, perhaps written in C
2) Create some sort of specification for a single static docroot  
where each WSGI egg gets its own symlink into

#1 still leaves me with the WSGI app sending static data, which isn't  
ideal but so far it works and I can put the WSGI app under any URL  
prefix without a problem. It also requires me to dynamically generate  
the URL to all static information.

#2 is probably easier in some respects, since if the scheme is a  
given (ie, /media/PACKAGE/VERSION/FILE.GIF) then I don't need to  
generate all the URL's and the webserver can be pointed to the static  
files root.

Has anyone else thought of ways to deal with this? If I missed some  
prior thread about this exact topic that solves it, sorry.

- Ben


More information about the Web-SIG mailing list