[Web-SIG] more comments on Paste Deploy

Ian Bicking ianb at colorstudy.com
Thu Mar 8 01:13:22 CET 2007


Jeff Shell wrote:
> Often we have web apps, written in Zope 3, that are really two or more
> web apps. Like an 'admin' side and 'public' side, typically handled
> via different skins/views. Apache rewrite rules basically handle that
> routing. So in my mind, if I deploy our CMS, I have the following URL
> maps:
> 
> http://example.com/admin/(.*) => examplesite/++skin++CMSAdmin/$1
> http://example.com/(.*) => examplesite/++skin++ExamplePublic/$1
> 
> Same Zope application, with just a couple of different settings based
> on the incoming URL, and then Zope and our app handles the rest of the
> URL.
> 
> Is that a site installation? Two site installations? Or two examples
> of website composition? Again, I'm just trying to understand the
> terminology and map it to the way I'm used to working, and I think of
> the above as 'site installation'.
> 
> The other tried and true example I can think of is when a customer
> asks "uhm, and can we have a forum with that?" I guess website
> composition might include the above two URL maps, plus one for:
> 
> http://example.com/forum/(.*) => SuperTerrificPylonsWebForumWSGI
> 
> But should this be the provence of WSGI? With Apache rewrite rules, if
> I was doing such a blunt grafting of 'forum' onto my customer's site,
> I could just as easily use phpBB. Then I'm not limiting myself to
> Python if I feel there's a better suited tool for a particular task.
> 
> I brought up this forum example because it's something we've run into
> a couple of times and may be about to encounter again. Depending on
> customer needs and wants, one of our thoughts is to just drop in some
> PHP bulletin board or some other feature complete app.
> 
> So if SuperTerrificPylonsWebForumWSGI is basically a black box - I
> configure its colors, templates, etc, but expect no other integration
> with the customer's main site / CMS - what benefits might I get from
> composing via WSGI?

Well, here's how you might do it in Paste Deploy:

[composite:main]
use = egg:Paste#urlmap
/ = cms
/admin = admin_cms
/forum = forum
/forum_phpBB = forum_phpBB

[app:cms]
use = Zope
instance_home = %(here)s/zope
root_object = examplesite
default_view = ExamplePublic

[app:admin_cms]
use = cms
default_view = CMSAdmin

[app:forum]
use = egg:SuperTerrificPylonsWebFormWSGI
database = mysql://localhost/form_db

[app:form_phpBB]
use = egg:wphp
base_dir = %(here)s/phpBB


But then lets say you want all these pieces to look similar:

[composite:main]
...
/_theme_files = theme_files
filter-with = deliverance

[app:theme_files]
use = egg:Paste#static
document_root = %(here)s/theme_files

[filter:deliverance]
use = egg:Deliverance
theme_uri = /_theme_files/blank_theme.html
rule_uri = /_theme_files/rules.xml


And then all the content, regardless of its source (could be PHP, piped 
in via HTTP, or static files) gets piped through Deliverance which wraps 
them all in the same outer theme.  An even more common use would be to 
wrap everything in an authentication middleware that sets REMOTE_USER, 
something that can even be used by PHP apps (at least some PHP apps, 
like WordPress, make using this kind of authentication pretty easy).

You can mostly do all this stuff via passing HTTP around, and I actually 
really like the ability to easily do HTTP requests based on a WSGI 
request, but it's a lot easier to exchange request information in WSGI 
than HTTP by itself.


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


More information about the Web-SIG mailing list