Having talked about my favorite combination of web frameworks – Angular for the frontend and Django there’s still one more thing I want to cover on the web framework side: Flask. For “serious” web development, Django has been my default choice, but I did end up with several Flask applications. In some cases, I already had a database layer written in SQLAlchemy, so porting that to Django would have only taken time and using Flask meant I could use it with no changes.
Flask is a “micro” framework and excels in those “I really need to get something running right now” cases, more so if you’re working with others who may not be familiar with Django, as Flask literally allows you to get up to speed with a single file. It also comes with very extensive documentation that covers plenty of “real-world” problems that you might run into.
In my experience, Flask also excels at being highly modular yet never feeling like a set of disjoint pieces. I had one case where I started with Flask and had to grow the application relatively quickly by adding a proper ORM, integrate with a task queue, and replace the HTML templates with a REST interface that was driven from an Angular SPA. Even though that resulted in significant changes to the application, I never ran into issues with not being able to make a change because components would stop working or something. This ability to scale is welcome if you’re just starting out and you don’t know very well where you’re going. The REST API in particular was interesting – I had to change all page templates to produce JSON, and this was something that I did right within Flask. If you’re occasionally writing some web tool, and you want to get something up and running within an hour, do give Flask a try!