Python web application frameworks, in brief. Based upon my recent experiences. Pylons ------ Really really big, has everything, well designed, MVC system. Pros: * Reasonably well documented Good tutorials, lots of information, lots to find via google. Not perfect, it's still a bit hard to be sure where something method comes from sometimes, but this is a large system, so that's not really surprising. * MVC Very clear definitions betwee the parts of MVC * Includes a system for auto-restarting/reloading changed code * Very nice session management built-in The session-management stuff is pretty transparent, you don't really have to do anything at all, and it Just Works™ * Native support for SQLAlchemy And you don't have to do anything really, just give it your database URL in the config, and then 'Session' is your database session object. Very simple. * Nice seperation of development and production versions * Easy to make work with FastCGI Although you do need to make sure that the FastCGI parameter SCRIPT_NAME is unset. And *reload your Pylons app* after this change :) * Reasonable ways to break out of URL handler code on error And you can even catch exceptions and generate pretty error pages from them very easily. * Very nice method to generate URLs from the routing map You can do url('calendar') and Pylons will look this up in the routing map and return which controller and action this means, or just the URL. You can also store static URLs to offsite services, managing them in a central location. And also, this is available within your templates, you never have to deal directly with URLs. * Lots of access to backend code within templates Pylons provides a great way to access globals, helper code, session data, etc from within templates, not just a single set of "context" data that you put there. For example, you can access 'foo' in lib/helpers.py by saying: ${h.foo()} or session data with ${session.user} or generate a URL with ${url('calendar')}. (This is Genshi syntax) Cons: * Must do things the Pylons Way It's a bit like django in that you have to set things up to be "a pylons app" rather than just using some libraries, but I guess all the good ones will be like this. It's a bit more sane overall, pretty well designed. * MVC It's a bit too obviously split up into M, V, and C, which can be a little annoying sometimes, having multiple places you have to do things in order to get something done, but at least it's set up very well. * Comes with multiple template engines The majority of the stuff people post on the web are done with Mako templates, not Genshi, so sometimes it's a little hard to find information if you have an issue that only exists because you're using Genshi with Pylons, for example. * Multithreaded, needs thread-safe globals If you need to have a global library, you better make sure it's either thread-safe, or used within a single request/response action. web.py ------ Simple, basic. No main objects passed around, you have to do a lot with globals (or singletons) if you want to have say, a single database or LDAP connection. Pros: * Can be very minimal If you're doing something basic, then you won't need to use much of web.py at all, it won't get in your way. Cons: * Uses exceptions to control program flow. * Global context object * Full of extra junk No, I'm not going to use their bizarre wrapper around the various database libraries, which includes it's own really weird query object. * Documentation sucks Remember that web.ctx.home - I can't figure out where you set that, or if you even do. The docs for web.application() say it takes a parameter fvars (dict) - but I can't find anywhere that suggests what it actually does with that. There are many examples like this. * Feels like a disjointed and unconnected box of tools Fatal flaw: If you want to do a HTTP redirect, you have to do: raise web.Redirect('/path') Oh and that path isn't absolute, even if you have a leading slash or you also pass parameter absolute=True. No, really. It will try to tack web.ctx.home or web.ctx.realhome on there if you do say absolute=True, but where the hell do you set those? cherrypy --------- Interesting, looks like a decent framework, doesn't do a lot of the annoying things that web.py does. Pros: * Easy to make simple things Seems very easy to get a simple one-file web app up and running, if you don't need to do anything really special and aren't making a large site. * Easy cookie management * Easy to return arbitrary HTTP status codes * Includes a system for auto-restarting/reloading changed code Cons: * Overuse of code decorators * Config files There is a config file... that you can optionally use. And you can have a config file for each 'application' as well as 'global'. Overcomplicated. * Poorly organized and confusing documentation There is an okay tutorial that gets you doing only the very very very basic case, using their own web server. Not sure why you'd want to do that. There is, however, a nice tutorial on the website for the Genshi templating engine. * Confusing method of configuring URL -> handler mappings Fatal flaw: You must make a hirearchical object that matches your URL paths. I.e. if you have say: /user/profile/jsmith Then you must have a class called root.user.profile with a method jsmith(). Oh and root.user.profile() and root.user() must exist too. And you can't easily serve a path with a dot in it (i.e. /foo/bar.xml) without making a default handler for all of /foo and doing extra work. Django ------ Pros: * Extensive documentation * Highly configurable and extensible * Lots of included components * Very MVC Cons: * Very MVC * Huge and all-encompassing. * Must use django template engine Well I guess you could use your own... but then you're doing a bunch of DIY. The included language isn't really all that nice - it's primitive and often difficult to work with. 1.2 version is FAR better than previous, but still lacking. * Must do things "the django way" You have to setup your application with a certain structure and certain directories and such like that.