Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

I normally recommend that people learn Flask if they really want to learn. Flask is simple and you have to do more yourself, which means you really get to understand how each component works. Django will get you set up faster, and has a lot of third-party middleware that you can use off-the-shelf. If you're learning, some of it will seem like magic and it'll take longer to figure out what does what.

TL;DR - Flask for education and simple projects. Django for creating CRUD apps where you just need it to work.

Shameless plug -- I wrote this comparison[0] which shows how "Hello, World" is written in Flask and Django, and goes over some pros and cons of each in more detail. The editors added the "Why Flask might be better" part to the title, which caused most of the discussion about the post to turn into a flame war, but I tried to be as objective as possible (although I do prefer Flask -- another shameless plug for my book[1] Flask by Example).

[0] https://www.codementor.io/garethdwyer/flask-vs-django-why-fl...

[1] https://www.packtpub.com/web-development/flask-example



I disagree, I don't think Flask is better for learning than Django, It is true that many components are already built inside django but the complexity is not really hidden, the developers still need to understand how the framework works.

For sure you can create a basic view with a ModelSerializer by hiding all the complexity, but very often it won't be enough to build what you want to build, and therefore you will have to search trough the documentation how things works.

In my opinion both Flask and Django are good for learning purposes, but Flask requires the user to handle more complexity than Django, which is not always the best thing if you want to learn


It definitely boils down to personal preference in the end. I always hated trying to wrap my head around solutions before understanding the problem.

By using Flask first, you also end up thinking "wow, every time I build a flask app I go through these same repetitive steps. Would be nice if they were automated". Then you find they are automated in Django.

If you learn the solution first, it seems irritating and sometimes you never understand the problem that it's solving.


I think one of the big reasons to try Flask first is to learn what magic is under the hood. If you start with Django, you're asked to build your MTV in a very specific way. That way Django can give you stuff like XSS/CSRF protection.

If you don't know what magic Django is doing for you, it feels restrictive to do stuff the Django way.


I don't mind Flask for writing projects, but coming into an old Flask project where the dev is no longer around isn't as fun.

Mostly because the structure can be absolutely any shape, the last one I went onto used the Django structure, but it may as well have just been Django.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: