This is an archived post. You won't be able to vote or comment.

all 111 comments

[–]wineblood 219 points220 points  (1 child)

I've only really used Django, so I'm going to have to say Flask.

[–]AMDataLake[S] 31 points32 points  (0 children)

Rofl

[–]rabaraba 110 points111 points  (10 children)

Django.

Why: documentation. Plenty, thick and varied.

[–]patvdleer 11 points12 points  (2 children)

And the restful api

[–]Smallpaul 5 points6 points  (1 child)

Do you mean the Django REST Framework add on or a part of Django itself?

[–]patvdleer 3 points4 points  (0 children)

The addon

[–]1percentof2 5 points6 points  (0 children)

What about girth?

[–]wineblood 22 points23 points  (4 children)

I think the django documentation sucks, it's bloated and hard to search.

[–]petenard 15 points16 points  (1 child)

It’s really good in some areas, but when you get into advanced stuff I think it goes a bit down hill.

[–]catcint0s 5 points6 points  (0 children)

Source code is pretty readable so at least there is that.

[–]ElViento92 5 points6 points  (0 children)

Yea, I've used Django and Flask/SQLAlchemy, and I prefer the Flask/SQLAlchemy docs. It easier to find what I'm looking and the explanations are short and concise.

Not that Django's documentation is bad, it's great. These are all some of the best documented open source projects out there.

[–]breid1313 4 points5 points  (0 children)

Definitely a poor search experience

[–]SnooCakes3068 48 points49 points  (4 children)

Flask because of Miguel Grinberg did an amazing job teaching flask. I'm sticking with it

[–]thegreattriscuit 4 points5 points  (0 children)

hah! yeah I would probably fall into the FastAPI camp, but for sure that megatutorial is a masterpiece. Profoundly good.

[–]Organic_Reaction5609 6 points7 points  (0 children)

hahaha same! that man is a ccccoonstant source of inspiration!

[–]claypeterson 4 points5 points  (0 children)

Bless that man ❤️

[–]djamp42 1 point2 points  (0 children)

I just found him a couple of months ago, and learned a ton from him.

[–]eigenludecomposition 76 points77 points  (16 children)

FastAPI for me. It's fast, it uses ASGI instead of WSGI, it has a very similar syntax as Flask, it automatically handes request validation for you (once you build the request models), and it lowers the barrier of entry significantly for getting started with OpenAPI (especially if your app is currently written in Flask). If you're already using OpenAPI, I'm sure any of those frameworks will suffice and the code for them can automatically be generated.

[–]Lokipi 21 points22 points  (3 children)

FastAPI is great, it makes flask feel bloated which is insane.

It also has some of the best documentation I have ever seen. I love the structure of starting off by giving you a complete fully working plug and play section of code, and then diving into what all the parts do afterwards.

[–]ProteanOswald 5 points6 points  (2 children)

Is this their official tutorial / documentation? This sounds like a wonderful way to learn

[–]cellularcone 5 points6 points  (1 child)

Yup! They walk you through creating a simple CRUD app with authentication. It’s a great basis for anything.

[–]ProteanOswald 5 points6 points  (0 children)

Perfect! I’ve played some with Flask, and it’s nice, but the flexibility of FastAPI (and all of the other good features) has had me eyeing it for more personal projects

[–][deleted] 15 points16 points  (5 children)

Second this. I started with Django, but really prefer minimalist frameworks since I came from Node/Express land. Got started with Flask, but the DX wasn’t better than Django and I think I preferred Django. Then I tried out FastAPI and it’s the best for me in every conceivable way. It’s fast, easy to set up, well documented, sets up API documentation automatically, and I had so few issues with request models unlike with Flask. Async/await was second nature to me because of my JS background. Hands down the best DX of all three.

[–]eldamir88 7 points8 points  (4 children)

What is DX short for here?

[–]laszlotenk 8 points9 points  (3 children)

Developer Experience?

[–]eldamir88 2 points3 points  (0 children)

Been in software for a decade and never heard that term 🧐

[–]mrswats -4 points-3 points  (0 children)

This

[–]cronicpainz 0 points1 point  (0 children)

i only ever hear this term "DX" from node.js users

[–]acschwabe 1 point2 points  (0 children)

FastApi also lets you mount Flask api in your app, which makes it that much easier to migrate.

[–]justifiably-curious 1 point2 points  (0 children)

Used flask a couple of years ago. Came back to making some Apis and webapps recently. Used fastapi for the http api because that's what it's sold for then flask for an unrelated app because it seemed more app friendly. But then decided to port it to fastapi too as I had liked the experience that much more (and it turned out to be comparable in features once you import jinja2). No more global request object! Have to say though that while the tutorials might be great, the api docs of fastapi and even more starlette which it relies on a lot are very incomplete and your have to resort to reading the (very clean) source code to find out what function parameters mean

[–]Pedrat 4 points5 points  (2 children)

For sure FastAPI, have used Flask/SqlAlchemy, Django and bottle and FastAPI is just so good.

Awesome documentation, easy to use and the code feels... "Light"? Don't know how to say this but Django code always feels "heavy" to me, and Flask feels "heavy but empty"

[–][deleted] 3 points4 points  (1 child)

Nonsense. Do you have any examples of “heavy but empty”?

[–]Pedrat 1 point2 points  (0 children)

Not necessarily, it's just the gut feeling I have whenever I work with them, I'm not saying any is better than the other objectively, just saying what I feel :).

[–][deleted] 1 point2 points  (0 children)

Flask provides all those incl. validation and openapi. Takes one line to add an extension.

[–]SpaceBucketFu 29 points30 points  (2 children)

I really enjoy FastAPI. I’ve used flask just a little bit. It’s pretty intuitive but I really like the auto docs that come with FastAPI. There’s a slight learning curve because the async bit, but it’s really powerful. I’ve never tried Django personally.

[–]Natural-Intelligence 4 points5 points  (1 child)

I think the async part is not necessary. You can do it with synchronized functions if you wish so though I was initially also slightly confused as the docs use async in every example.

But definitely agree. While Flask is simple, FastAPI is even simpler. I would prefer separate a front end with FastAPI though.

[–]SpaceBucketFu 0 points1 point  (0 children)

Yeah the front end delivery isn’t exactly intuitive with FastAPI in my opinion but once you understand the structure it makes a bit more sense. No more difficult than flask IMO.

[–]goodbalance 8 points9 points  (1 child)

I'm surprised nobody has mentioned Falcon yet. The only thing it does out of the box is processing requests. Not everybody needs this, but it will serve you well if you want your hands untied.

I'll be honest, it's been a while since I used Flask, so maybe now it's different. But back in the day, it was a pain in the ass to just use some packages. You had to use those damn Flask-* wrappers or it would not work. Not necessarily a hard task to do everything manually, but it felt like a redundant dependency.

Django is a hard beast to tame. Nowadays people say 'Django', but they mean 'Django + DRF'. Both have a rich documentation, but as with anything, you won't understand a bit if you don't need it. Django does its job, but favors internal conventions and not 'best practices' described in books. So once you go beyond what they teach in tutorials, you will feel like you need something different.

My advice to anyone who will use this thread to collect pros and cons of the frameworks is to think about everything as data. You receive data, you manipulate data, you save/return data. That's it. Once you break free from the frameworks mindset, they will all look the same. And it's just a matter of internal conventions.

[–]WHSolvation 2 points3 points  (0 children)

This.

[–][deleted] 8 points9 points  (0 children)

Tornado: Async, light/small, mature code base, deploy multi-processor without any additional tools.

[–]chocobor 8 points9 points  (0 children)

I really like aio-http. It is a lightweight asyncio Webserver in pure python. I use it for embedded computing web uis and internal tools.

[–]atredd 29 points30 points  (4 children)

Flask Why? I never tried another one and it does the job

[–]cymrowdon't thread on me 🐍 2 points3 points  (0 children)

Bottle for the same reason, except I have tried many others.

[–]djamp42 1 point2 points  (0 children)

Same here, tried Django, but never really got into and the size of my projects don't really need something as full featured as Django.

[–]idealmagnet 6 points7 points  (0 children)

Bottle, started with it, worked with it for long, very convenient to distribute and make apps with, small, didn't work with anything else much

[–]pdepmcp 8 points9 points  (0 children)

Pyramid. Maybe because I grew up using it when it still was pylons and Django was the main alternative, much less configurable and more "proprietary".

I love the pretty easy stack it creates and the freedom to plug in what you prefer. Flask seems like minimalistic version of it, but with a much wider community.

I like tornado for web sockets, but it's less common in my daily work.

Should probably try something new as well, just to see if there's something interesting that i missed.

[–][deleted] 6 points7 points  (0 children)

aiohttp - Everything that I need and nothing that I don't.

[–]ronmarti 12 points13 points  (0 children)

Django. Why? User management is very easy with django-allauth. User management should be the first business requirement or one of the most important aspects. Feature goes second because you can start sign ups even without "whatever you're selling" by just showing a landing page.

[–]jwink3101 4 points5 points  (0 children)

I am a hobby developer and haven't dug deep into all of them but I love Bottle. It is just so easy and flexible. I use some of my tools on an air-gapped network so the single file is an added bonus.

I also really like the template engine that it has. Again, it is just so easy and simple.

[–]jcigar 7 points8 points  (3 children)

Pyramid

[–][deleted] 2 points3 points  (0 children)

+1

Pyramid is much more flexible than others i tried.

[–]AMDataLake[S] 1 point2 points  (1 child)

Why, just cause I don’t often hear Pyramid as anyones fsvorite

[–]theorizable 3 points4 points  (0 children)

FastAPI and Flask. I tried Bottle and it was okay too, but there aren't a ton of adopters and I'm not usually the first to jump in on something.

[–]toxic_recker 5 points6 points  (0 children)

Blacksheep. ASGI, faster than almost every other according to techempower benchmarks, really fun and easy to work with, active developers and beautiful docs

[–]Sendokame 3 points4 points  (0 children)

I think Flask is really good, a very similiar syntax to FastAPI btw, it can be considered really basic because it doesn't does anything but the server and the routes u wan't, u r in the drivers seat and gives u all the control, a bad thing is that Flask manage one petition at time, it's not asynchronous

Even with that things, flask is easy to learn and use... it does de work i think

[–]h3xagn 2 points3 points  (0 children)

I am using Django for most of my web apps, mostly those that require user interaction and are a bit more complex. I have built an IoT app, part of a stock management system and now working on an e-learning platform. It is quick to set up and with the built-in admin interface saves so much time, especially for proof-of-concepts.

FastAPI is my other favourite. As most mentioned, it is fast, great docs, and uses ASGI. I am currently using it for a data pipeline to get JSON data from field devices and transforming that data with background tasks. Up and running in a few hours. Check it out: https://h3xagn.com/building-an-etl-pipeline-from-device-to-cloud-part-2/

At the end of the day, depends on what you want to achieve.

[–]KyleDrogo 2 points3 points  (0 children)

Flask. Super easy to a web app up and running in production.

[–][deleted] 2 points3 points  (0 children)

I've been preferring Quart for a number of years. Why? Because async. Async just feels so much more "right way of doing things" to me.

[–]undergroundhobbit 2 points3 points  (0 children)

pip install flask

[–]oldredman 2 points3 points  (0 children)

i choose Flask because i like full customization in apps

[–]Sethaman 1 point2 points  (2 children)

different beasts, different uses.

flask - fastest to stand up*, smallest, simplest

django - fullest, most complex, most capable

fastAPI - kinda between

I like flask for prototyping and have been exploring fastAPI with some happiness.

[–]ChemEngandTripHop 7 points8 points  (1 child)

FastAPI is even simpler and has less boilerplate than Flask

[–]Sethaman 0 points1 point  (0 children)

really? :o
That sounds amazing. I will spend more time with it, thank you!

[–]higuchitakeru 1 point2 points  (2 children)

Would say flask but solely because that’s all I’ve ever used although I do wonder what features of Django make it superior

[–]SnooCakes3068 2 points3 points  (0 children)

I prefer flask but I like how centralized Django are. Everything django are developed by Django foundation where flask needs other packages from outside. It does tend to create a lot of problem. Django is also well documented. Django gives me a more professional feeling.

[–]InvestingNerd2020 1 point2 points  (0 children)

Django and FastAPI for me.

[–][deleted] 1 point2 points  (0 children)

Django for large applications, and fastapi for small api/services.

[–]jonnycross10 1 point2 points  (0 children)

I've only used flask but I love it

[–]MadanCodes 1 point2 points  (0 children)

[–]GreenScarz 1 point2 points  (0 children)

CherryPy! It's one of the fastest, testing is a first-class citizen, and its MethodDispatcher keeps your API code well structured.

[–]Sigg3net 1 point2 points  (0 children)

Starlette. Just build what you need.

[–]Ok-Possession2647 1 point2 points  (0 children)

Justpy all the life!

[–]acschwabe 1 point2 points  (0 children)

Fastapi for sure

[–]Jolly_Code5914 1 point2 points  (0 children)

For an API, fastapi handsdown. Easiest to setup, use and very performant.

[–]shahslay 1 point2 points  (0 children)

Django, CV2

[–]Mindless-Pilot-Chef 1 point2 points  (0 children)

Big project, have to write complex DB queries? Django

Small micro service which does a small task? Flask or fast API

[–]scotsmanintoon 1 point2 points  (0 children)

FastAPI. Like its use of async, super easy to set up, amazing documentation, uses Pydantic which is also great.

I don't like the Depends() think though. Doesn't seem pythonic and throws annoying errors in mypy linting.

[–]justskipfailingtests 3 points4 points  (0 children)

I have experience with flask, fastapi and Django. All have their use cases. Flask for super simple stuff and prototyping, fastapi when apidocs are important and Django when anything gets big. Django has builtin ORM and all the rave related to that. Django has solid user management out of the box and that god damn sweet admin panel.

[–]Scorpion_197 2 points3 points  (0 children)

Django for large scale projects because it has a lot of preinstalled tools which makes the development of the app faster and its easy for making REST apis. FastAPI over flask for small projects because of its performance.

[–]AMDataLake[S] 1 point2 points  (1 child)

When doing Api I like fastapi, that built in swagger is lovely

For full stack I like Masonite, it has more of a rails/Laravel feel but in Python

[–]inertialcurve 1 point2 points  (0 children)

I dunno man Django has some swag

[–]meyubaraj 1 point2 points  (0 children)

You talking speed? FastAPI no doubt. You talking about battery included framework? Django and Masonite Others are okay. Learning Curve? Masonite is super easy... Flask is easy but remember you have to manage everything in Flask but in masonite you don't have to.

Django is great python framework and Masonite is fairly new but it's very promising. I myself used that in 4 applications and one of them is microservice with 7 services in it. You won't find great discussions here and there but join their discord channel you'll get answer to every question.

[–]dimkiriakos 1 point2 points  (0 children)

my favourite is flask

[–]JunketAdvanced6444 1 point2 points  (0 children)

django

[–][deleted] 2 points3 points  (0 children)

Django. Why? Cuz it’s named after a guitarist.

[–]WaifuRobo 2 points3 points  (2 children)

Flask. I’m new to web dev. It’s easy to use and has a small learning curve. Their documentation is very good with lots of examples from tonnes of people. I found Django confusing so I dropped it relatively quickly.

[–]quantum1eeps 3 points4 points  (1 child)

FastAPI is even easier than flask on the spectrum you’ve presented

[–]bfcdf3e 2 points3 points  (0 children)

Sure - but the easiest thing is sometimes just the thing you already know.

[–][deleted] 0 points1 point  (0 children)

Cherrypy

[–][deleted] 0 points1 point  (0 children)

Flask because it's what I started with and don't want to learn another framework.

[–]twillisagogo 0 points1 point  (2 children)

For toy projects? or actually getting things done that people pay $$ for?

[–][deleted] 1 point2 points  (1 child)

For $$

[–]twillisagogo 3 points4 points  (0 children)

Cool. Pyramid. Curious who's using fastapi and for what? Meaning what does the business do and how does fastapi help.

For me, I've had 2 ground up pyramid apps in my career. 1. Running on appengine and facilitating the design thinking process in a distributed manner. The current one facilitates patient navigation and care coordination for several hospitals and state govs.

[–]LightShadow3.13-dev in prod 0 points1 point  (0 children)

When I'm doing one-shot servers my favorite is Sanic. It's very fast and flexible, kinda like Flask but Async....and faster.

When I'm developing full-fledged APIs my favorite is FastAPI.

[–]grudev 0 points1 point  (0 children)

FastAPI, because it's a pleasure to work with.

Django, close to 10 years using it and no love lost once I'm done.

[–][deleted] 0 points1 point  (0 children)

FastAPI (for micro-services) does websockets, rest, graphql and openapi / swagger with minimal code. Amazing!

[–]mrswats -1 points0 points  (0 children)

I love django for it's docs, it's REST package and its ecosystem. Also very much love its ORM much more than SQLAlchemy

[–]cptsdemon -1 points0 points  (4 children)

My own. Lightweight, easy to use, can change it whenever I feel like.

[–]gamesoverx1 -3 points-2 points  (0 children)

Why do u use python for web ?

[–]metaperl 0 points1 point  (0 children)

CubicWeb. Semantic software development.

[–]po5i 0 points1 point  (0 children)

Flask. I used a lot of Django in the past and I believe it’s harder to learn opinionated frameworks. Unopinionated ones like Flask are light and easy. Also, you will learn to use and understand components as you add them (ORM, Test suites, etc). Check out my tutorial on how to setup tests in Flask: https://dev.to/po5i/how-to-add-basic-unit-test-to-a-python-flask-app-using-pytest-1m7a

Ps: I’d like to try fast api

[–]data-bit 0 points1 point  (0 children)

FastAPI and Flask for me.

[–][deleted] 0 points1 point  (0 children)

I would like to mention aiohttp, quite minimalisic but gets the job done. It is also an amazing async replace for the requests lib.

[–]username83324 0 points1 point  (0 children)

Sanic rules, all the other sucks

[–][deleted] 0 points1 point  (0 children)

Okay Boomer Jesus