1. 35

    1. 22

      If you don’t want to read the whole article, it starts with this summary:

      Django, not Flask, is the better choice for beginners’ first serious web development projects.

      While Flask’s simplicity and clear API make it great for learning and suitable for experienced developers, it can mislead beginners about the complexities of web development. Django, with its opinionated nature and sensible defaults, offers a structured approach that helps novices avoid common pitfalls. Its comprehensive, integrated ecosystem is more conducive to growth and productivity for those new to the field.

      1. 17

        If a beginner is looking for their first “serious” web development project, there are so many better tools and ecosystems out there–Elixir and Phoenix, PHP and Laravel, Ruby and Rails, Node and amphetamines–than Python and Django.

        If the beginner is just learning, busting them down to the basics of Flask (if one must stay in Python) is just fine so they get a feel for all the obnoxious stuff.

        At the end of the day though, whatever gets them up and running and feeling good about shipping code is a good solution–whether that’s Flask, Django, or Cobol on Cogs!

        1. 12

          Node and amphetamines

          Thanks for the first laugh of the day, you got me good. I even had to search the web to make sure this wasn’t some new library that has taken over the Node ecosystem.

        2. 2

          Elixir and Phoenix

          Come on, be real…

          1. 4

            Yeah, I can’t recommend beginners Phoenix. Not because it’s hard to learn, or lacks world-class documentation (it passes both of those tests with flying colors), but because it will ruin the rest of webdev for them. “Dang, I’ve seen such a better way to do this in Phoenix”.

        3. 2

          I recently wanted to write more Python web code, and I was disappointed that no other “big” frameworks seem to have taken root other than Django. Don’t get me wrong, Django is fine, I just thought there might be something else after all this time. With Flask/FastAPI/etc, you’re left to build a lot of the things Django handles for you.

          1. 1

            There’s Pyramid/Pylons, Zope/Plone and Turbogears, all of which have been around many years. And Odoo is making some serious headway in the business world.

            1. 1

              Thanks, I don’t know how I missed these! Gonna have to give them a closer look later

        4. 1

          there are so many better tools and ecosystems out there–Elixir and Phoenix, PHP and Laravel, Ruby and Rails, Node and amphetamines–than Python and Django

          What makes these better than Python or Django ? Nothing about Go ?

          1. 5

            Golang doesn’t have a good cohesive opinionated first start into proper large webdev. It’s made by people who enjoy linux from scratch :/

            1. 1

              I would say that while there have been various attempts at making “Rails for Go” none has become popular so far. Go ships with an Express/Flask/Sinatra mini-router, and most people either use that or a third party library that ends up being pretty similar.

          2. 3

            OP is already disfavouring flask for being no-batteries-included, throwing anything go into the conversation would just exacerbate that argument.

    2. 17

      People won’t let go, they won’t accept that the paradigm of rails is a bad idea. They see flask and similar libraries eating their lunch and come up with these contrived made up reasoning that cannot be put to test.

      Every single django codebase I have seen have became unmanageable, most of them have been replaced. We know the reasons nowadays but some diehards don’t want to let go for nostalgic reasons.

      Back in the day, rails, Django and similar were a quick way for a beginner to have access to quite a lot of useful things. The web development ecosystem has matured tremendously, such things can be mixed and matched at will, without the need for a gigantic decision lock called Framework, that will essentially get in the way of adding unexpected functionality.

      The oficial python documentation covers how to use usgi and asgi as well as the SQLite module, that is where beginners should start. They will get results an order of magnitude quicker than if they start learning django.

      This reads like all those perl and PHP posts. They had their time and they were great. We can even learn something from them and might still be useful in specific situations. But things have evolved.

      1. 23

        they won’t accept that the paradigm of rails is a bad idea

        I often saw that argument, but never saw any proof for it.

        Every single django codebase I have seen have became unmanageable

        Every single codebase, no matter the framework/library you use, can grow to become unmanageable, this is not a Django problem.

        Also, I’ve seen more unmanageable Flask/FastAPI codebases than Django ones, so who is right? I wanna say that both our dataset are biased.

        1. 7

          I often saw that argument, but never saw any proof for it.

          I have seen a lot of bad Rails code in my career, and feel pretty confident in saying that the mutable-state free-for-all that Rails and Django are built around is unworkable. It’s possible to avoid the footguns but that is not the general case.

          This is less an indictment of dynamic languages, rather the particular misunderstanding of MVC that Rails popularized and spread far and wide. You can achieve high degrees of correctness in dynamic languages, but the approaches you take need to be very different than you would in a static typing system. But I am probably wandering too far off-topic.

        2. 6

          My experience is that teams inevitably end up bouncing between the two poles:

          “Why did we use this huge full-stack framework? Let’s get rid of all that junk we don’t use and switch to something lighter!”

          Some time later…

          “Why did we use this microframework? Look at all the stuff we had to build on our own! Let’s stop maintaining all that custom code and switch to a full-stack framework!”

          Some time later…

          “Why did we use this huge full-stack framework? Let’s get rid of all that junk we don’t use and switch to something lighter!”


          The exception is when you actually are operating at a scale where no off-the-shelf tech stack does what you need. For the Python world, it has been empirically established that this occurs when you are approximately Instagram in size, and at that point it is generally considered “a good problem to have”, at least for your stock option value.

      2. 13

        Every single django codebase I have seen have became unmanageable

        Every successful codebase will become unmanageable but Django will do fine until a much higher point than Flask.

    3. 13

      I’ve never had a project that involved building the kind of app that Django wants to be used to make.

      1. 10

        I have, and built it in Django. It felt like the right tool for the job and it worked out fine.

        I think Django is overall pretty well engineered and good at being what it is (a rails-like big framework).

      2. [Comment removed by author]

    4. 11

      I do enjoy Django more than Flask because it is batteries included and opiniated (making my own decisions is exhausting). If you really want the FastAPI experience, there is django-ninja.

      In any case, sprinkle some htmx on top of that, and you get a nice SPA without React/Vue/whatever :)

      There is even django-htmx for a nice integration in views and templates.

      The Django ORM fulfills 95% of my use cases, I don’t need something more powerful.

      And for those remaining 5%, let’s not forget that the Django ORM provides unmanaged models. Using PostgreSQL views to abstract complex queries and then creating an unmanaged model for it is often the way to go. And if you don’t mind the occasional raw SQL, PostgreSQL’s stored procedures/functions are there too.

      The only real downside to Django’s ORM is that its async API is still a PITA: async code can’t be called from sync context, but sync code can’t be called from async context either. This means that for those models:

      class Foo(models.Model):
      class Bar(models.Model):
          foo = models.ForeignKey(Foo, on_delete=models.CASCADE)

      The following code will not work:

      bar = await Bar.objects.aget(pk=1)
      foo = bar.foo # sync call

      And has to be replaced with:

      # pseudo-code, i don't remember the exact syntax
      bar = await Bar.objects.aget(pk=1).prefetch('foo')
      foo = bar.foo # no sync call, prefetched
    5. 10

      Here I am hanging out with Bottle and having fun. Flask is HUGE in comparison.

      1. 3

        I ♥️ bottle.py ! If you want to talk about something to point a beginner at its hard to beat a “framework” that any one who knows python can sit down and read (and understand!) in an afternoon.

    6. 10

      I tend to agree. On the other hand, doing a small project in Flask that quickly gets out of control teaches you why you want to use the MVC patterns, etc. Once you have internalized the patterns, you don’t need Django anymore, but it is helpful to have a place to learn it from and trying to go it alone and failing also gives you the motivation to learn it.

      One way to think about it is when to use which in the learning process. For a student doing independent study in university, Flask is probably fine for making a small mess. For a junior dev at a company, you want Django so they don’t screw up the company app and you can give them books to read to learn the basics.

      1. 7

        Flask is MVC:

        • SQL (model)
        • Jinja (view)
        • Python (controller)
      2. 4

        I don’t believe that postponing learning SQL after the N+1 bites you in production is the way to go, to be honest. Maybe use Flask (or FastAPI or something) and train the newcomer a bit more extensively? Maybe even walk them through the codebase. Or perhaps write a CONTRIBUTING.md that actually incorporates feedback from newcomers?

        1. 5

          What’s the learning context we are imagining? I think junior on their own and junior in a firm with senior code review are pretty different. And student experiments are even more different.

    7. 9

      I could not disagree more.

      Flask is the best place to begin and build out your knowledge. You aren’t going to learn anything if you’re frustrated and stuck in just getting a “hello world” running. Flask lets beginners dive right into learning web requests without the “opinionated” bloat. For large projects, sure, pick something more robust, but I learned how to build apis and web apps with Flask from day one and I appreciate how simple it to this day.

      1. 5

        I hear you about the joy of diving in, and initial momentum is important to learning, but learning is determined by more than initial momentum.

        Flask doesn’t teach you about common problems in web development, it lets you experience them. That may lead to learning insofar as you are equipped to recognize and solve the problems yourself. But the knowledge is not in the framework, it has to come from you.

        Django, as an example of the opposite, has a whole spectrum of well-named SuspiciousOperation exceptions: when one of those occurs, you see it in the logs. Now you know that is ‘a thing’, and so you learn from the framework.

        Both are suitable for ‘learning with’, and they both need educational scaffolding of different kinds, but I’d say Django has the most for ‘learning from’.

    8. 8

      Django has an opinion. Like all opinions, it is debatable, but when you start web dev, your opinion likely sucks

      This is why I agree. I can understand an argument that Flask is simpler and thus provides a smoother learning curve, but Django’s upfront complexity can solve the “I don’t know what I don’t know” problem. I would have never learned what CSRF attacks were nearly as fast if I didn’t have to debug error messages about them at my first job.

    9. 6

      I don’t think a beginner should work with a framework where you have dozens of auto-generated files and can’t understand what 90% of them do without spending hours reading documentation.

      1. 4

        I think that’s a matter of whether you prefer bottom-up or top-down learning. If you prefer learning things in a bottom-up fashion, you are absolutely right. A top-down approach would involve getting something up and running quickly, ignoring things that haven’t been explained yet, and then digging into the details gradually as you need them. For that, something like Django would be fine.

        Different styles would work better depending on the teacher/student pairings, I think.

    10. 5

      But web development is not simple. It is filled with little traps, you have to make a ton of decisions right…

      However flask assumes you know. It has a small feature sets, and is not very opinionated. To use it correctly, you have to know what you are doing.

      I’m curious what the author thinks a “beginner” should be doing and learning exactly. In my experience, a beginner should be making mistakes, they should be confronted head on by complexity which they didn’t expect, they should be learning…

      But the newcomers I met that put Flask in prod for their first projects get scars from it.

      This is an even weirder observation, who is letting loose these noobs to develop and learn in a vacuum and then deploy to prod?

      1. 6

        who is letting

        Plenty beginners are not in situations where there is anyone to “let” or “not let” them do things?

        1. 2

          Prod is a strange place to keep programmers who don’t draw inside the lines without a framework that forces them to. That seems like a whole different issues than preferring/recommending one framework over another.

          1. 4

            “prod” in the context of beginners learning their first web things is most of the time a high-school student or hobbyist putting their hobby project online. Or someone playing with a side project. Who exactly is going to tell them “no”? Plenty of space to burn yourself still. And people do in practice carry that experience (including lack of experience of corner cases) into jobs later - where it’s also not given there’s senior oversight if its a small place (I can think of a bunch of people I know who went into their first web jobs with basically zero oversight, hired by people with the same amount or less knowledge)

            Sure, if you teach people web programming in a company with more experienced people at hand, don’t do that. But that’s not how many people get going with webdev.

            1. 1

              I’m not even sure what you’re arguing here. Hobbyists and kids putting project on the internet is “prod” now? And these people are going to be “burned” by their inexperience, so we should be telling them to rely on a framework that is going to somehow protect them from making mistakes by insulating them from learning things in “prod”.

              You’ve really gotten me spun around here.

    11. 4

      My A level computer science non-exam assessment project was a web application in Flask. I never actually completed it (traditional methods of assessment were abandoned when coronavirus happened) but I found its documentation to be excellent for a beginner. I don’t think I’ve found any documentation as easy to read, navigate and learn from as Django’s since.

      But when I, about a year later, tried to teach Django to someone I was tutoring one-to-one over the Internet, I found it difficult to get the concepts across. My tutee had taken quite well to the general concepts of Python programming up to that point; I think the problem might have been that they didn’t understand the reason why what they were learning (the layout of Django’s files) was so much more complicated than what they were doing before. When I had learned Django, I had learned it using the tutorials which are part of its online documentation, which gave me a reasonably good theoretical introduction to MVC. But with my tutee I focused on the practicalities. I didn’t know Flask at that time but I might have used it instead if I had.

    12. 2

      /me cries in custom SQL generator because Django ORM can’t JOIN and everyone keeps repeating “you must have a wrong problem because Django is the perfect solution”.

      It seems to me that Django has painted itself into a corner interface-wise and now any improvement will require major refactoring that will break a lot of production stuff for a majority of users.

      1. 4

        Joins are one of my favourite features of the Django ORM. What’s not workied for you?

    13. 1

      When I was learning web development back in 2010, I evaluated Ruby on Rails, Flask, and Django. Flask was the right place to start for two reasons: First, it was small. I had a much easier time figuring out what the important parts of the framework were. Second, I found the Flask documentation much easier to understand than everything else. It had a tutorial that didn’t assume prior knowledge of web development or the MVC pattern. It went into detail on each and every part of the framework. I remember it being pretty wonderful.

      I ultimately ended up going with Rails, but reading the Flask docs on similar patterns and concepts first made getting started there much easier.

    14. 1

      I agree that Flask is probably the better starting point for beginners. I find the sheer amount of files + stuff presented to you out of the box with Django can be intimidating.

      Developers will write unmaintainable Django apps and people will use this as an argument to switch to Flask. They’ll also write sprawling unwieldy Flask apps and wish they’d had some of the guardrails of a framework like Django.

      I’d say it completely depends on the project. At my $work we’re very happy with Flask + GraphQL (Ariadne + SQLAlchemy) because we’re not really dependent on any Flask extensions.

      For personal stuff I’ve been able to bootstrap stuff much faster with Django because I made a conscious decision to embrace/utilise the framework. I.e: use the admin, use their built-in auth, use django-celery integration etc. When you’re trying to hand roll all those integrations in Flask it becomes a real pain.

    15. 1

      Actually, beginners should use Quart, not Flask and definitely not Django.