New developers: Choose Django over Flask

Django and Flask are two of the most famous and useful frameworks in the Python ecosystem, so naturally, when I wanted to pick one of them to learn, I was very confused. I finally decided to settle on Flask, because it seemed to be more flexible, cool, and had fewer things to learn. Over the next few days, I coded a small app in it.

My learning through all this: Don’t do this if it’s the first time you’re learning a framework. Flask might be a dev’s dream when it comes to flexibility, but this very dream will become a learner’s nightmare:

  • There are very few, if any, walkthrough tutorials on Flask. It looks like the community is kind of scattered, and comprises senior devs who understand what each other is doing.
  • It’s a pain to figure out the various components. I had a really rough time jumping through hoops of flask-login, flask-security, flask-wtf, etc., when setting up forms and security. Because the documentation of these extensions is standalone, there’s no way to tell how one affects the other. For instance, while creating forms, some of the classes are to be imported from wtforms while the rest are to be imported from flask-wtf. flask-security, if you happen to use it, also has a default LoginForm class, which made me spend several hours in frustrations when my forms were behaving weirdly.

I guess mostly that’s it. The pain of trying to learning the basics of frameworks and also figuring out how the locks and keys fit together can be overwhelming. Pick something like Django, which you don’t have to understand in entirety at the start.

Leave a Reply

Your email address will not be published. Required fields are marked *