Django for Productivity. Flask for ...?
Django vs Flask. I decided I'd code up an oversimplified blogposting platform to see what works better for an application of medium scale and say 10K hits a day. I Googled a whole lot, and though there are nice diagrams people have made, you never really know until you try both. This has been on my to-do list for a good 18 months and I finally have an answer.
Flask for scalability, they said.
Will you really need that scale they never asked.
Flask for flexibility, they said.
Are you mature enough for designing your own structure they never asked.
Django for productivity, I say.
Django unless you want to make all-code-on-one-page simple AWS Lambda like API.
Django for almost all medium-large scale webapps you'll ever need.
Django all the way.
Truth be told, Flask is easy to learn. Literally, all you do is put an annotation above a function and you have a HTTP endpoint.
The "overhead/heavyweight" Django gives you everything you'll really need maybe 1-3 months down the line embedded right into its design. If you're building an e-commerce/purchase-tracking/instagram like webapp, you do need an admin panel, a whole lot of APIs to access the database, and an auth system. Plus, if companies like Instagram and Pinterest are using it, there's good reason that most things you'll ever need already exist within Django or as a community plugin. So Django honestly isn't heavy. You'll need everything it gives to you anyway.
Here's why I've been disliking Flask for the past 6 months. Our codebase isn't structured well because we keep changing our requirements every other month and the flexibility kills here because we keep changing on an ad hoc basis. Plus, whenever we need to modify our database or add a completely new disjoint table, our web engineer at Tonbo Imaging spends a whole day to do it.
- He first creates a database model.
- Next, he creates the APIs for accessing the database.
- He then creates an admin panel specifically to access this part of the database.
- Finally, he creates the user facing UI for that dashboard.
Ugh. Django gives you 3/4 for free.
Yes, there's Flask Admin, but why go for someone else's library when if you'll need something like Django-Admin down the line anyway. Use Django which ships with all this built deeply into its core.
Plus Django's documentation is hilarious!
|Hahaha. "Your time on the web".