Student Login

Django or Flask? Let's settle this right now

Charming, ruggedly handsome reader Jay asks:

"Django or Flask? Or perhaps, when would you choose Django and when would you choose Flask?"

I know, I know... there's been so much written about this already. But here's my answer:

Master both.

It turns out they are varied enough, and have enough of their own strengths and weaknesses...

There's really no short explanation that will help you choose which to learn. Or even, which to use for a project.

ANY web app can be written with either Django, or Flask. But one may be a much better fit than the other, for that particular project.

You can't know which, until you have a "feel" for both of them. Until you've coded enough in both, you start to get a sense of what they're good at.

Flask is a little more minimalist. Django has a few more batteries included.

Anything else I can say about them, won't help you decide which one to learn and which to ignore.

If you're able to learn one of them, it's not that much more work to learn the other. And learning both will make you a better developer, and better at Python.

(At several levels. For example, you'll learn about trade-offs in library design, by learning how Django and Flask solve the same problems in different ways.)

So pick one to start with - it doesn't matter which, because you're going to learn both. If you want me to tell you, go alphabetically: Django first.

Then work through the official tutorial for that one - Django, or Flask. And then the tutorial for the other - Flask, or Django.

If you want another practice project: do Django's tutorial, but in Flask. Then Flask's tutorial, in Django.

Then start writing real webapps in each. Look for excuses to use both, until you've done a few projects for each framework.

So if you've been asking which to learn... you have your game plan now.

And once you've done what I've described above, you won't have to ask which you should use for a new project. You'll just know.

For Teams Bootcamp