WSGI based Python web frameworks
I keep hitting road blocks with Django and have read about Pylons. Pylons seemed to be exactly what I needed (greener grass), but then I realized that they have global variables all over the place and loads of black magic infused by dark spirits (spirits so dark that they even kill unicorns).
Is there anything out there that is enterprise worthy (ie, doesn't impose performance or scaling restrictions), stays the hell out of my way, but provides the basic request/response handling, sessions, SQLAlchemy (perhaps), and a way to plug in templates, etc? Is there any hope?
I've been trying to develop an SAAS in Django, which is a nightmare. They don't support multiple column primary keys, and there are a number of other problems with ModelForms, etc that yo开发者_StackOverflow中文版u don't run into until you're developing a more complex application (especially with multitenancy. I don't use their auth system and don't need to as I built my own. I just need security (CSRF, XSS, SQL injection, etc).
The most hard-core low-level web-framework for python - Werkzeug - http://werkzeug.pocoo.org/
Flask: http://flask.pocoo.org/ It will look like an entry-level framework, but in fact it's extremely powerful. It's based on werkzeug and support Jinja2 out of the box. I'd go with this one. You can get easily integrated SQLAlchemy with extensions like flask-sqlalchemy and WTForms (similar API to django.forms) with flask-wtform. There are tons of useful other extensions for it, like extensions that add the ability to use mongodb and couchdb easily. What's most notable about flask extensions is they provide very consistent behavior and there is an actual approval process for them, as opposed to django reusable apps 95% of which are a mess.
精彩评论