I have been writing serious, database backed, large dataset, etc etc web applications using Python for about 4 years. Although it may seem like bragging, I probably know the ins and outs and what-have-yous of the python web programming landscape as well as anyone.<p>State of web programming in python:<p>The frameworks:<p>Django: More powerful? No. Faster, more seductive. In the long run you'll outgrow it, if you are any good. It gets you from zero to twenty five percent almost instantly, then gets in your way. The ORM is a terrible mess. The template language is <i>easily the worst</i> (slowest by 10x, slow enough that common templates take 300ms to render, insanely unusable 500 line tracebacks), of any of the common python templating languages. Once you swap out the ORM and the templates, you suddenly realize what is left is also a piece of crap. Django middleware are horrid. I remember trying to write a database session middleware and an error-reporting middleware in django, only to determine it is literally impossible (there are edge cases where any middleware can be skipped and never see the request). When having to deal with it, I use it's oddball WSGI adapter and park WSGI middleware in front if it. I can not say enough bad things about django, it is rotten through and through compared to the alternatives. The admin interface is neat, but is basically a toy once you run into real complexity or data volume. I might use django if I were making a content based application on contract, since the admin interface would be a huge piece of free functionality, or a very simple web app, like a hotel website or something.<p>Pylons: WSGI based, thank the lord. This means you can write real, flexible, efficient, predictable middleware. I was a huge Pylons fan from around the beginning of 07 until I discovered Werkzeug near the end of 08. I still lurk in #pylons quite a bit, and it was at my urging that the Banquet library (a common interface to all template systems) was discarded (although it may have been on it's way out anyway). Pylons uses great libraries under the hood (webob, beaker, etc), and I would recommend it without hesitation. The __call__ method of the BaseController class used to be a complete mess, I would guess that it still is. Luckily you only run afoul of it very occasionally. the __before__ and __after__ methods are handy. When I stopped using it they were still recommending AuthKit officially, but the mood of #pylons seemed to be (and I agree) that AuthKit is a horrifying abortion that should never be used. The canonical stack with Pylons is Pylons-SQLAlchemy-Mako. I would swap Mako with Jinja2, although who use Mako tend to be loyal to it, and there aren't too many huge warts (the way it does template inheritance makes my head hurt though). TLDR-Pylons good.<p>Werkzeug/Flask: My personal favorite. You are building a web application, you should have all the moving parts where you can adjust them as necessary without bolting on bizarre hacks, and Werkzeug lets you do that. It may be a bit of a jump for a beginner. Flask is an attempt to make a 'framework' out of Werkzeug, and it seems to be getting some momentum. If you know what you are doing, I believe Werkzeug is the best thing out there for Python web programming.<p>Tornado/Twisted: Either is great. Due to the pain of dealing with them (you need special event driven db adapters, etc) I would only use them for long-polling applications or the long polling portions of a general application.<p>Also rans: Turbogears: crap, web.py: crap. Also also rans: Zope (if you don't know what it is already, you probably don't want it).<p>How to deploy:<p>mod_wsgi for Apache is the <i>one true way</i> to deploy python web applications. Anything else (fastcgi, reverse proxy, etc etc) is a hard to maintain, unreliable, mess. I would put mod_wsgi on each webserver, and have a machine running nginx or varnish or pound as a load balancer. Varnish is the best if you want to do sophisticated caching or edge side includes, nginx is easy and fine also. Everybody seems to want to argue for something besides mod_wsgi, since Apache is so unfashionable. Part of me wants to encourage everyone to do so, because it makes it drop dead easy for me to walk in and 'fix' your apps reliability problems in about a half a day, and look like a genius in the process. You can deploy python applications to run multiple threads per instance, but realistically due to technical limitations of the interpreter you don't want to run many threads. I suspect less than 10 is the optimal amount. Luckily you can have mod_wsgi spin up multiple processes as well. I would have it recycle the processes after around every 25000 requests, even if you don't have any memory leaks in your app.<p>Database:
I recommend SQLAlchemy. There isn't really anything else worth mentioning. Even if you hate ORMs (there is a strong argument for and against), the sql expression language SQLAlchemy gives you is basically the most amazing thing there is. It takes quite a bit of time to master. If you use SQLAlchemy, use the defaults for the Session until you understand it, or you will end up spending a lot of time and trouble mucking with it.<p>Nosql: I don't trust it. I suppose I might be becoming a dinosaur, but I also haven't had a major use case where I really needed it.<p>Other: These don't really have to do with python specifically, but I'll throw them in at the end here:
I recommend Redis over Memcached. I strongly recommend Postgresql over Mysql (unless you don't understand what a join is). If you have lots of images (say over 2000), put them in S3 from day one. Some stopgap solution is more painful to fix later than earlier.