views:

186

answers:

1

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 you 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).

+3  A: 
  1. The most hard-core low-level web-framework for python - Werkzeug - http://werkzeug.pocoo.org/

  2. 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.

dekomote
@dekomote - Thanks man. So, Flask basically adds a little bit of a stack to to Werkzeug then, if I understand.
orokusaki
Exactly. You don't have to wrestle with setting up the wsgi app like with werkzeug and you have it's power on your hands.
dekomote
@dekomote - Gosh, thanks a lot. This is very helpful. I've read lots of good things about Flask, but until now I've regarded it as "probably like CherryPy; not good enough for high-traffic enterprise". So, you wouldn't say that Flask has any huge contention points (like Pylons' global variables and magic)?
orokusaki
I suggest reading the documentation a bit just to be on the safe side. It's small, easy to configured and it's not tight coupled like Django.
dekomote
@Vasil - thanks for adding the xtra bit. Would you consider Flask "good" for larger, more complex applications? They seem to warn against it on their site and I wonder why. The explanation seems to be just a disclaimer of sorts.
orokusaki
@orokusaki I've never used it to build "large" applications. As far as I know no one has, which doesn't mean anything since the framework is a few months old. I think it wasn't designed with writing "large" applications in mind in the first place. But, stuff has been added to it to support this kind of endeavour. One approach might be splitting up components of your project as extensions. Extending Flask. Even if you use django for large projects you may find it stands in your way, flask being so small means you may even consider forking it to suit your project needs.
Vasil