Flask vs Django

Deciding how you are going to put your website together is clearly an important decision. You generally need to make that decision up front and it will go on to haunt you for some time. As I've already mentioned I've decided to go with Python rather than PHP, but I've also chosen to use the Flask web development framework.

Generally speaking I'm firmly in the pro-framework camp. Any added 'bloat' that they add is firmly offset by the time one saves. Moreover, there's a certain amount of forethought that goes into any half decent framework that the developer greatly benefits from.

I've fiddled around the edges with a range of frameworks for a while now. I think I've done the Django tutorial three or four times now. I've also had a tinker with Web2py, Bottle and Flask and have ultimately ended up really loving Flask.

But firstly, why not Django? I really like Django, it's hard not to. It's full MVC which works really well for me having used a few MVC frameworks in PHP. It also just takes care of all sorts of things like models and users/logins out of the box which is a massive plus.

But for this project I basically want to build an API, at least on the server/Python side of things. Javascript will take care of the front end, I just need a web app that outputs JSON.

In the end I settled on Flask. From when I first started looking at it to now it really seems to have taken off. The other micro-frameworks seem dated in comparison (not sure if that's actually true). It just gets out of your way and lets you crack on with things. You can structure your app however you want and there are plenty of addons for it - for example SQLAlchemy which certainly makes database management a lot easier.

It's also just super quick to throw something together with. When I wanted to put some photos on a map after a holiday in Scotland, it took me a few hours to throw it together (code here. I wanted to do a few things with Soundcloud like add filtering - a few hours later a friend and I had build a little app that meant we could filter by track duration amongst other things (code here).

The biggest downside though is that the documentation for all these plugins (and even Flask itself sometimes) is quite poor and has considerable gaps. Which is one of the reasons I'm writing this blog - I'll share what I find difficult to find the answer to in the hope that it helps someone else.

So there you have it. I'd like to know more about Python frameworks. Are there MVC alternatives to Django for example? What are the other big players out there?