3 ms·
> So having used both, this is what I tend to say about them: some of Flask's commonly-used components are better than django's (SQLAlchemy notably), but altoge
by sametmax 9y ago
> So having used both, this is what I tend to say about them: some of Flask's commonly-used components are better than django's (SQLAlchemy notably), but altogether, django is a better framework.
Most Flask dev however, are unable to leverage the full power of SQLalchemy. They do miss the nice integration of the Django ORM, espacially the form generation, admin and fantastic app ecosystem that assumes you have a User object.
> Making a sane and maintainable project layout is not a particularly easy thing to do
+1000 on this. I noticed this as a dev AND a trainer. In the end, flask is great if you are either very beginer and want to do simple things, or very experienced. For all the rest, you want Django.
But the price to pay to enter the Django world is higher.
> It shouldn't be a shock to you by this point if I say that I don't think flask is particularly well designed either, but I won't go into my interface-by-interface rant now...
Well, the global objects such as request is one of my pet peeve... And the decision of a central "app" object make modularity kinda difficult, and blueprint feel like afterthoughts.
But flask also almost invented the whole @route API, which is really awesome.
- ris 9y ago> But flask also almost invented the whole @route API, which is really awesome. -1000 on this. It's a side-effect-on-import nightmare. Not to mention scattering your url scheme all over your view modules makes it much harder to spot where your scheme doesn't make sense. In my opinion.
- sametmax 9y agoIt's declarative configuration, I don't see how more side effects you get than with the Django way.
- ris 9y agoViews "register themselves" as functions that should be called given a certain URL at import time. That is a side effect and it's horrible if you want to do anything more subtle. Way more "magic" than anything django does.
- sametmax 9y agoDjango does the same thing. urls.py are imported automatically at startup, even if you run a regular manage.py command that doesn't run the server.
- ris 9y agoThat's not remotely the same thing. In django, one specific file is looked for and imported if it exists, django then looking for an `urlpatterns` in it. No side effects anywhere. Just a default place to look for something, much like it does with models.py.
- wruza 9y agoYou can use regular routing instead of route decorators in flask, iirc. http://flask.pocoo.org/docs/0.12/api/#application-object add_url_rule
- bildung 9y ago>But flask also almost invented the whole @route API, which is really awesome. Hasn't that been inherited from bottle?
- antod 9y ago> But flask also almost invented the whole @route API, which is really awesome Emphasis on the 'almost' :) Turbogears was doing something similar with @expose about 5 years earlier.
- Omnius 9y agoJust want to point out since you mentioned it that turbogears is still out there, maintained, new releases, and a great framework.