by superxor · 14y ago · 0 comments
(Never using web.py and not being fully aware of Django's status in 2005) I see that overall they seem to have faired well. All you need is a settings.py file to run a Django app. The templating is slow performance-wise but pretty expressive.
I love that the Django community as a whole is pretty responsive to criticism. The 'Why Django Sucks' talk at DjangoCon is an example. My biggest complaint was the horrible User model (you cannot not have 'username' for a Django app using the User model). But they've fixed it now. The major complaint against Django is that it is monolithic, but the devs have worked hard to keep the system decoupled allowing one to replace most modules. But if you want something small Django is not the one for you I guess, and there is nothing wrong in it. One size fits all is never possible to achieve and not a good solution too.
If you're looking for a nice Python web framework, try Pylons/Pyramid
Pylons is loosely coupled. Not Django.
Django is not bad and it certainly makes it easier for 99% of projects out there (CMS style). But for the 1% it's a pain.
If you want to use an ORM, or have database backed sessions, or user logins, you need to write all that yourself. For example: http://flask.pocoo.org/docs/patterns/sqlalchemy/
Depending on what you're doing, that might be a good thing - but I find writing things which are already included in Django pretty annoying.
The extensions were mentioned; User logins for example are just a "pip install Flask-Login" and "from flaskext.login import whatever" away. I had reason to roll my own, ~100 simple lines that were easily plugged.
There are pros and cons, neither is "better", the right tradeoff depends on what you're making.
However, the Extensions library [-1] (which is not strictly speaking part of Flask) provides quite a lot of functionality - apart from your referred SQLAlchemy (which does the job well in our backend), there's a nice API generation factory [0] [1] and other neat stuff. For quite a lot of intents/purposes, flask extensions will do the job. But in the end of course it is a microframework. (From limited personal experience, a very neat general-purpose microframework nevertheless!)
[-1] http://flask.pocoo.org/extensions/ [0] [1] A particularly sexy example that simply uses models from SQLAlchemy (from the quickstart in [0]): manager.create_api(Person, methods=['GET', 'POST', 'DELETE']) manager.create_api(Computer, methods=['GET'])
where Computer and Person are DB models easily defined with the help of SQLalch.
(This is not to counter (there isn't anything to be countered, just providing links / luring people..)
Flask is not a "micro" microframework per se.
It provides a thin facade over werkzeug - which is anything but lightweight or micro.
I said everything you need to make web apps in Python, and I stand by that. Maybe it doesn't have an ORM or user account management, but for my purposes, it's great for small apps.
I like the mapping of a resource to class and method names to class method.s I am not sure I like Flask's method handling and having to do if ... elif .... else (maybe I just found some bad example, so please correct me).
Also url dispatching at the top makes it easier to understand what's going on rather than having it spread to each of the decorators somehow.
Functionality added usually doesn't break what currently works (except maybe for bugs fixed)
Django isn't loosely coupled by default, but it can be used in a relatively loosely coupled way. E.g. you can easily use your own SQL and templating engine. Yes you can't just hot swap in a new web framework without rewriting the core app code, but that's the case with every framework.