Why haven't you written this 12 months ago? I started a project which in the beginning was a simple one (and of course I went with Flask - bang bang one file, a few routes and I got my website up and running) and now after 12 months of Flask development, I ended up with a huge pile of mess. I did use factory setup and blueprint and all that organizational recommendations but I still ended up with a Behemoth of an app that powers everything. So yes, I think you are right, if I would have to start this over again I would have gone with Django. Thank you for the article tho :) - this confirms what Iw as thinking in the beginning :).
Beginners should not use Django or Flask at all. They should use Anvil instead. Fun from the beginning. Learning curve in days, not weeks! Check it out. In the free version you can accomplish a lot.
A stack that locks you up with a vendor is definitly NOT what I would recommend to a beginner that has no way to undertand the consequences of this choice.
I think the tech is cool and I wish the project good luck, but no, anvil is not a contender.
If a beginner sees this comment I would recommend to stay away from anvil until you have enough experience to understand the implications.
I agree that in general I dislike vendor lock-in. However in this specific case about 4 years ago I tried to build an application in Django and in Flask and it was just too difficult. For repeating elements on a page I had to dive into blogs and Youtube instruction video's to get it working. And the it didn't look good because I was not well educated in CSS. I was very happy to discover Anvil and my joy for programming was back again. I could now develop much more complex interactions without much hassle and it looked much better too. The Anvil community is very responsive and enjoyable. You can easily see this if you look into the forum and see how much patience is given in answering questions. Anyway, I was glad to discover Anvil and without paying anything you can accomplish a lot. For commercial use you will need an subscription, but by that time you should earn money with your application as well. By the way the Anvil server code is open source which you could host yourself. But it would give you extra infrastructural work. Altough not too difficult if you're used to run Django or Flask :)
As an intermediate developer writing his first web app, I spent a fair amount of time trying to decide between Flask and Django. In the end, as a beginner, Django's batteries included approach won the day. Sure, set up is more involved and a certain amount of under-the-hood knowledge is necessary to really make Django sing, but the built-in security features made it more than worth it for me. I had to learn Django, not Django and multiple 3rd party libraries.
py4web hits the sweet spot between the two. Can be as minimal as you want but also provides the tools for db, auth, access control, htmx, etc. Simple to learn, lightning fast development and execution. The follow-on framework from the creator of web2py that addresses the concerns of webpy.
Yeah, for a proper webapp, Django is great. Flask ha all these blueprints and other methods, but I could never understand them (and it was easier to just read Django docs). People say Flask extensions are easy to use, but I disagree-- the very 1st step, choosing which ext to use is itself a pain
I will disagree with you on one point-- you are talking about webapps. Maybe its the backgound Im in (Test Automation, mainly in hardware firms)-- but there have been many times we wanted a simple web frontend for internal data,, and Flask is perfect for that. just 1-2 pages that displaysome metrics. These are internal apps so we never cared about usernames or databases-- at most a simple hardcoded password.
FastApi, in case anyone mentions it, is built on the hype and farts of unicorns
Sure, if it's an internal dashboard, go for it. But internal app have a tentency to grow past their poc, and I don't wish any beginner to have to bolt on ldap auth from flask.
This is great advice if you're getting into web development and plan to expose a website to a public/semi-public audience.
I feel the value proposition may tilt in the other direction towards Flask/FastAPI (especially the latter), if you're attempting to write code to expose an API (eg for a microservice) but don't plan to include a website. Thoughts?
Couldn't agree more. When I first started working, I didn't understand why other coworkers were using a framework as versatile as Django in their projects, I chose to use flask and like you said gained extra scars. Over the years of working, I've also seen a lot of people use flask to build projects that are difficult to maintain (most notably ORM, which simply doesn't have a robust ORM extension in flask)
Agree 99%! Django is great framework to start building things. It is daunting at first, but if you starting with tutorials and docs you will have no trouble.
I would add one more thing for beginners that is very useful to do - dig into Django internal code! Use IDE tools to go deep into functions. Read the code. Read the functions docs and looker for other usage of same functions across the internals. It will be super learning experience about how to write great code, how Django works. This knowledge will carry on to future projects and will make you awesome dev!
I agree it's the place to start. I started with Django back in 2006 when it was version 0.9-something, occasionally experimented with the other frameworks. For the last couple of years, the toy projects I spin up for myself and friends these days are simpler and I do those with Flask, Peewee, SQLite, and APSW.
This is correct. Micro-frameworks are the way to go once you know what you are doing. Like *really* know what you are doing. You will be building a "mini-Django" for each project with Flask (or Quart).
It's repetitive, it's time-consuming, but it will give you a lot of control, and it will matter a great deal once the project grows to a size where a framework like Django stops working for you and actually starts being in the way.
Why haven't you written this 12 months ago? I started a project which in the beginning was a simple one (and of course I went with Flask - bang bang one file, a few routes and I got my website up and running) and now after 12 months of Flask development, I ended up with a huge pile of mess. I did use factory setup and blueprint and all that organizational recommendations but I still ended up with a Behemoth of an app that powers everything. So yes, I think you are right, if I would have to start this over again I would have gone with Django. Thank you for the article tho :) - this confirms what Iw as thinking in the beginning :).
😂😂😂,
Last year I was to mess up but my intuitive got me Django instead of Flask
Beginners should not use Django or Flask at all. They should use Anvil instead. Fun from the beginning. Learning curve in days, not weeks! Check it out. In the free version you can accomplish a lot.
A stack that locks you up with a vendor is definitly NOT what I would recommend to a beginner that has no way to undertand the consequences of this choice.
I think the tech is cool and I wish the project good luck, but no, anvil is not a contender.
If a beginner sees this comment I would recommend to stay away from anvil until you have enough experience to understand the implications.
I agree that in general I dislike vendor lock-in. However in this specific case about 4 years ago I tried to build an application in Django and in Flask and it was just too difficult. For repeating elements on a page I had to dive into blogs and Youtube instruction video's to get it working. And the it didn't look good because I was not well educated in CSS. I was very happy to discover Anvil and my joy for programming was back again. I could now develop much more complex interactions without much hassle and it looked much better too. The Anvil community is very responsive and enjoyable. You can easily see this if you look into the forum and see how much patience is given in answering questions. Anyway, I was glad to discover Anvil and without paying anything you can accomplish a lot. For commercial use you will need an subscription, but by that time you should earn money with your application as well. By the way the Anvil server code is open source which you could host yourself. But it would give you extra infrastructural work. Altough not too difficult if you're used to run Django or Flask :)
See: https://anvil.works/forum/t/django-or-anvil-which-one-should-i-pick/9665/15
As an intermediate developer writing his first web app, I spent a fair amount of time trying to decide between Flask and Django. In the end, as a beginner, Django's batteries included approach won the day. Sure, set up is more involved and a certain amount of under-the-hood knowledge is necessary to really make Django sing, but the built-in security features made it more than worth it for me. I had to learn Django, not Django and multiple 3rd party libraries.
Not tried
Py4Web?
Py4Web.com
py4web hits the sweet spot between the two. Can be as minimal as you want but also provides the tools for db, auth, access control, htmx, etc. Simple to learn, lightning fast development and execution. The follow-on framework from the creator of web2py that addresses the concerns of webpy.
By the way, love the article.
As mentioned, not a big fan of global request objects.
Yeah. One other thing - Django's documentation is just outstanding.
Yeah, for a proper webapp, Django is great. Flask ha all these blueprints and other methods, but I could never understand them (and it was easier to just read Django docs). People say Flask extensions are easy to use, but I disagree-- the very 1st step, choosing which ext to use is itself a pain
I will disagree with you on one point-- you are talking about webapps. Maybe its the backgound Im in (Test Automation, mainly in hardware firms)-- but there have been many times we wanted a simple web frontend for internal data,, and Flask is perfect for that. just 1-2 pages that displaysome metrics. These are internal apps so we never cared about usernames or databases-- at most a simple hardcoded password.
FastApi, in case anyone mentions it, is built on the hype and farts of unicorns
Sure, if it's an internal dashboard, go for it. But internal app have a tentency to grow past their poc, and I don't wish any beginner to have to bolt on ldap auth from flask.
This is great advice if you're getting into web development and plan to expose a website to a public/semi-public audience.
I feel the value proposition may tilt in the other direction towards Flask/FastAPI (especially the latter), if you're attempting to write code to expose an API (eg for a microservice) but don't plan to include a website. Thoughts?
Fast api wou'd be a better choice than flask for an api nowaday, but I would recommand django with django ninja for a beginner.
Having the django admin to understand what your api does in the db is invaluable for a beginner.
Couldn't agree more. When I first started working, I didn't understand why other coworkers were using a framework as versatile as Django in their projects, I chose to use flask and like you said gained extra scars. Over the years of working, I've also seen a lot of people use flask to build projects that are difficult to maintain (most notably ORM, which simply doesn't have a robust ORM extension in flask)
Agree 99%! Django is great framework to start building things. It is daunting at first, but if you starting with tutorials and docs you will have no trouble.
I would add one more thing for beginners that is very useful to do - dig into Django internal code! Use IDE tools to go deep into functions. Read the code. Read the functions docs and looker for other usage of same functions across the internals. It will be super learning experience about how to write great code, how Django works. This knowledge will carry on to future projects and will make you awesome dev!
I agree it's the place to start. I started with Django back in 2006 when it was version 0.9-something, occasionally experimented with the other frameworks. For the last couple of years, the toy projects I spin up for myself and friends these days are simpler and I do those with Flask, Peewee, SQLite, and APSW.
This is correct. Micro-frameworks are the way to go once you know what you are doing. Like *really* know what you are doing. You will be building a "mini-Django" for each project with Flask (or Quart).
It's repetitive, it's time-consuming, but it will give you a lot of control, and it will matter a great deal once the project grows to a size where a framework like Django stops working for you and actually starts being in the way.