3 ms·
I used Django a few years ago but am now learning Flask and coupled with SQLAlchemy, WTForms and a few other extensions seems to be very intuitive and powerful.
by getup8 12y ago
I used Django a few years ago but am now learning Flask and coupled with SQLAlchemy, WTForms and a few other extensions seems to be very intuitive and powerful.
Just curious, what batteries in Django make it preferable to you over Flask+SQLAlchemy+Jinja2?
- andrewfong 12y agoApparently Jinja2 will now be one of the batteries included, so there's that.
- wldcordeiro 12y agoNot so much included, it's more like the battery slot that the Django template language fits in is now easily accessible. So you can change your "Duracell" [Django Template Language] for "Energizer" [Jinja2]. But it's a pretty great change as there are legitimate times that Jinja2 is worth using over the Django system.
- nnain 12y agoI learnt Flask first and then Django. I like Django more. Figuring out which Flask package to pick is lot of unnecessary work. In most cases, you would end up using templates, ORM, Security, Forms, Admin, Migration anyway. Django's defaults for these (now including Jinja2 with this release!) are quite good. Also I found SQLAlchemy tooo complicated. Too much to learn there. It might be really cool for edge cases, but I'm happy using raw SQL when/if the Django ORM (ever) falls short of my needs. Also performance benchmarks seem to suggest that Django is faster than Flask. This was a surprise to me. As in, it seems as if Flask is leaner so would be faster, but Django performs better than flask. Also, I kinda like the Django community more.
- noobhater1000 12y agonot to mention the vast number of packages, documentation and questions and answers on stack overflow for just about every topic that exists. rest api's (no out of the box support but plenty of documentation to make your own or just go with Django-rest-framework) Built in administration system/back end. easy cache plugins, middleware extensions, GIS support with Geo-Django
- getup8 12y agoI think this has been my biggest annoyance with Flask to date. Searching Google/SO on issues I run into provide far fewer results (and often none that directly answer my question) than Django. Still probably think Flask is worth learning first though as it gets you closer to the Python core and hoping if I switch back to Django the transition will be easy enough.
- jgroszko 12y agoCould you link to some of those performance benchmarks?
- scrollaway 12y agoI make part of my living from Django work. I like Flask a lot more. It feels a lot less boilerplate-y, eg for routing, views etc. One of Flask's strongest points though is Jinja2 IMO and Django getting that is fantastic news. I couldn't agree more on SQLAlchemy, though. Django's orm is nasty perf-wise and if you want to do anything low level, but API-wise it's really great. But SQLAlchemy felt like learning something even more complex than SQL itself... It's weird this isn't a solved problem.
- baq 12y agoSQLAlchemy core basically is raw SQL in Python syntax, but better - it's composable, whereas plain SQL isn't. SQLAlchemy declarative looks similar to Django's models, except it was designed from the ground up to handle multiple transactions and DB connections, which isn't necessarily true for Django's ORM. I wouldn't be afraid to say that SQLAlchemy is a state-of-the-art tool in ORM space (not only Python ORM space). Flask-SQLAlchemy extension adds some niceties that make it look even more similar to Django's framework.