I wrote about it on the Paste blog but I thought I'd note Paste Deploy here as well (release page). It's still a very young project (like three days old), but I'm feeling optimistic about it, and in various forms I've been thinking about it for some time.
Basically it's a way to configure WSGI applications. For applications that support this (or where you write some very minimal glue) you could do things like this (note that I haven't made any of these Paste tools available yet, this is an example only):
[DEFAULT] admin_email = me@example.com # pipeline puts some filtering middleware in front of an app [composit:main] use = egg:Paste#pipeline pipeline = login urldispatch # Put one login system in front of entire site [filter:login] use = egg:Paste#login database = mysql://localhost/userdb table = users # Then this passes different path prefixes to different apps [composit:urldispatch] use = egg:Paste#urlmap / = static /cms = filebrowser /blog = blog # a very simple app... [app:static] use = egg:Paste#static document_root = /home/me/htdocs # this puts the auth in front of the app [composit:filebrowser] use = egg:Paste#pipeline pipeline = auth filebrowser_app # the login filter should give us a username; this just restricts # who can access [filter:auth] use = egg:Paste#auth require_role = admin # this application is distributed [app:filebrowser_app] use = egg:FileBrowser document_root = /home/me/htdocs [app:blog] # In this case the app isn't distributed as an Egg with # entry_points, so we manually create a glue function blog_app paste.app_factory1 = myglue.apps:blog_app
Well... that's a fairly involved configuration, really. You can move parts of this to other files fairly easily, substituting config:config_file.ini for the references to sections (blog, static, etc). While many of the pieces (like egg:Paste#auth) don't work now, they will very soon -- many of these things exist in Paste or elsewhere, and just need a configuration shell. There's a few other outstanding issues, but I'm very optimistic.
I'm also optimistic about breaking Paste up into smaller chunks that are easier to integrate into other projects; this package is my first attempt at distributing one piece of the project in isolation.
After writing that example, I realized the use of egg:Paste#pipeline was too complex, so I added a couple constructs to make applying filters easier. Now it could be written like:
[DEFAULT] admin_email = me@example.com # Put one login system in front of entire site [filter-app:main] use = egg:Paste#login database = mysql://localhost/userdb table = users # This defines what the filter wraps: next = urldispatch .... # the login filter should give us a username; this just restricts # who can access [filter-app:filebrowser] use = egg:Paste#auth require_role = admin next = filebrowser_appRemoving the [composit:main] and [composit:filebrowser] sections.
# Ian Bicking
Looks almost like Perl... Not sure if that's a good thing. Scary.
Why invent new syntax rather than use Python? class DEFAULT: admin_email = "[email protected]" # pipeline puts some filtering middleware in front of an app class composit_main: use = "egg:Paste#pipeline" pipeline = "login", "urldispatch"# Oren T