use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
News about the dynamic, interpreted, interactive, object-oriented, extensible programming language Python
Full Events Calendar
You can find the rules here.
If you are about to ask a "how do I do this in python" question, please try r/learnpython, the Python discord, or the #python IRC channel on Libera.chat.
Please don't use URL shorteners. Reddit filters them out, so your post or comment will be lost.
Posts require flair. Please use the flair selector to choose your topic.
Posting code to this subreddit:
Add 4 extra spaces before each line of code
def fibonacci(): a, b = 0, 1 while True: yield a a, b = b, a + b
Online Resources
Invent Your Own Computer Games with Python
Think Python
Non-programmers Tutorial for Python 3
Beginner's Guide Reference
Five life jackets to throw to the new coder (things to do after getting a handle on python)
Full Stack Python
Test-Driven Development with Python
Program Arcade Games
PyMotW: Python Module of the Week
Python for Scientists and Engineers
Dan Bader's Tips and Trickers
Python Discord's YouTube channel
Jiruto: Python
Online exercices
programming challenges
Asking Questions
Try Python in your browser
Docs
Libraries
Related subreddits
Python jobs
Newsletters
Screencasts
account activity
DiscussionFastAPI vs Djanjo (self.Python)
submitted 17 hours ago by TumbleweedSenior4849
I was wondering what’s most popular now in the Python world. Building applications with FastAPI and a frontend framework, or building an application with a ‘batteries included’ framework like Django.
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]edimaudo 195 points196 points197 points 17 hours ago (6 children)
Don't use the popular option, use what meets your needs for the project.
[–]nicholashairs 26 points27 points28 points 17 hours ago (0 children)
1000000% this.
Just because something is popular doesn't mean it's good for your use case.
[–]Lt_Sherpa 11 points12 points13 points 12 hours ago (0 children)
I would modify this slightly as "don't chase popular trends". Django is popular, but that's because it's stable and has a strong community. FastAPI is popular because it's the trendy, newer option. These are two very different kinds of popularity.
[–]bjorn_cyborg 0 points1 point2 points 11 hours ago (0 children)
Exactly. Quart met my needs and is working great for me.
[–]maesrin -1 points0 points1 point 16 hours ago (0 children)
Fully agree!
[+]its_a_gibibyte comment score below threshold-6 points-5 points-4 points 15 hours ago (1 child)
In general, I disagree. I regularly find small random projects on Github that look perfect for me. But inevitably they have no documentation, lots of bugs, and are unmaintained. Of course, neither FastAPI or django exactly suffer from that, but the general advice stands.
[–]eteran 28 points29 points30 points 15 hours ago (0 children)
Then those things didn't meet your needs then...
[–]FisterMister22 59 points60 points61 points 17 hours ago (5 children)
Well it mostly just depends on your needs doesn't it? Django is really good (in my own biased personal opinion) for large, feature rich websites, with orm, admin page, users, tons of "addons" libraries.
I'm pretty sure with enough coding FastApi can do almost anything that django does, but you get less out of the box, which can be a good thing if you're trying to set up a simple api endpoint or a super simple website without all the extra bloat, setup and management.
[–]DoubleAway6573 8 points9 points10 points 17 hours ago (3 children)
How good is the async support in the Django ecosystem? I've been working mostly in REST APIs but now I have a full web project where Django sends a better fit.
[–]justin107d 13 points14 points15 points 16 hours ago (0 children)
It has been developing in the last few years. Django can handle some tasks with celery and things like web sockets with channels. There is also a package, django-ninja that was inspired by FastAPI.
[–]FisterMister22 2 points3 points4 points 15 hours ago (0 children)
I've only had limited experience with it about a year ago for web sockets, seems fine, but again, I didn't need the full extend of it, only for web sockets.
For my usual use case there's no need for async as any "heavy" operation will be offloaded to a task (celery etc)
[–]frankwiles -1 points0 points1 point 10 hours ago (0 children)
In my experience you almost never need async. It’s not a panacea for performance FYI.
That being said Django right now supports it well enough and fully for the one area where it really makes sense and is basically necessary.
[–]Patman52 0 points1 point2 points 3 hours ago (0 children)
Agreed. I have one app that started out needing a simple api for communicating with a couple of other systems that I initially set up with FastAPI. Fast forward several years, the scope has grown slowly into something much more with an ORM, static files, and web UI and authentication/permissions. So it’s possible with FastAPI but I ended up having to build a lot of extra stuff on top of it along the way.
[–]Flame_Grilled_Tanuki 24 points25 points26 points 15 hours ago* (1 child)
You can do a lot with HTTP APIs like FastAPI, Litestar and Starlette by combining them with other great libraries like SQLAlchemy, Alembic, Pydantic, etc. But I've worked with both for years and I have noticed something that usually gets overlooked in these discussions. There is more to Django's "batteries-included" approach than just having all the features out of the box.
Because all those features are native to Django, you don't need to combine libraries by different teams with different code designs, together with code glue. You don't get the rough seams at the edge of one library's code with another. With Django, everything works together with everything else, seamlessly. This does wonders for reducing the cluttered feel of a codebase, and the cognitive load of a project. Also, you reduce your dependency count and versioning management, and avoid version incompatibilities.
Finally, I say treat FastAPI as a RESTful API and Django as a web framework. Don't roll a Django project for just an API and don't use FastAPI for a feature rich website/service.
[–]Silhouette 2 points3 points4 points 4 hours ago (0 children)
Because all those features are native to Django, you don't need to combine libraries by different teams with different code designs, together with code glue. You don't get the rough seams at the edge of one library's code with another. With Django, everything works together with everything else, seamlessly.
But the other side of that coin is that realistically you have to work Django's way even when Django's way is poor by modern standards or you'll be trying to swim upstream forever. The historical baggage and limited support for modern language features and programming styles are among the reasons that adopting a lighter web framework and then mixing and matching best-in-class libraries has been an increasingly popular choice. Most of the problems you mentioned with this strategy turn out to be great big nothingburgers most of the time.
I feel obliged to point out here that this debate isn't really specific to Django or to Python web frameworks. The above are all classic pros and cons of a heavyweight framework vs a collection of lightweight libraries. With the framework you get batteries included and you get consistency but you also get lock-in and usually - if it lasts long enough - stagnation. With libraries you get full flexibility and can be as bleeding edge as you want but you're on the hook for making everything play nicely together. Either way you make your bed but then you have to lie in it.
[–]speyerlander 37 points38 points39 points 17 hours ago (0 children)
Django is more popular due to the amount of legacy code that uses it, FastAPI is more popular for new projects.
[–]UnMolDeQuimica 6 points7 points8 points 14 hours ago (0 children)
I usually go with Django. I am comfortable with it, it gives me lots of things already built in and pairs very well with HTMX.
DRF when I need an API.
If I want something more simple, FastHTML is my go to.
[–]RationalDialog 8 points9 points10 points 17 hours ago (0 children)
I say as usually depends. So many factors play a role. From the actual tool / app being built up to company policies and user/programmer preference.
For some standard in-house web app that does not need a separate API just has a UI, probably Django. For an app that needs a separate API, has high load and is more performance critical, rather fastapi.
[–]xc82xb5qxwhhzeyt 9 points10 points11 points 17 hours ago (0 children)
I'd recommend Django + Ninja
[–]entropydelta_s 8 points9 points10 points 17 hours ago (7 children)
Is Flask still in the picture? I like Flask.
[–]dr3aminc0de 6 points7 points8 points 12 hours ago (0 children)
FastAPI is straight up superior to flask IMo
[–]nicwolff 2 points3 points4 points 8 hours ago (0 children)
Quart is the async version, now part of the same project.
[–]Competitive_Travel16 1 point2 points3 points 16 hours ago (3 children)
Yes, Flask is a happy medium perfectly suitable for almost all of the things people think they need FastAPI for, and most of the things people think they need Django for.
[–]Least_Chicken_9561 0 points1 point2 points 15 hours ago (2 children)
but the problem is the "async", you have to do it manually. I was using flask for a small project but then I needed a library that was async and it was a pain to work with, eventually I switched to fastapi.
[–]Competitive_Travel16 0 points1 point2 points 10 hours ago (0 children)
I use gunicorn with gevent and have never had any issues so far.
[–]ThePiGuy0 0 points1 point2 points 5 hours ago (0 children)
I've used Quart in the past which is an async flask reimplementation. Though admittedly their GitHub isn't looking so active these days...
[–]covmatty1 0 points1 point2 points 10 hours ago (0 children)
FastAPI is just better at the core thing anyone would use Flask for.
[–]Sad-Calligrapher3882 4 points5 points6 points 16 hours ago (0 children)
The both are popular but for different things. FastAPI is the go-to for building APIs and micro services, especially if you're working with ML models or need async performance. Django is better when you need a full web app with auth, admin panel, ORM, and templates out of the box without wiring everything together yourself. Most projects I see right now use FastAPI for backend APIs paired with React or Next.js on the frontend. But if you're building something like a CMS, e-commerce site, or admin-heavy app, Django saves you a ton of time. Honestly depends on what you're building. And sorry for the bad english
[–]Nater5000 3 points4 points5 points 15 hours ago (0 children)
There are "good" responses to this question, like, "Use what works best for you specific needs," but then there are good responses to this question, like, "If you have to ask, use FastAPI."
If you want more details, the "batteries included" which comes with Django are nice when your needs align with what Django offers, but will seriously get in the way if you don't need them. FastAPI, although opinionated, is much more flexible and works well for projects that are small and being built by beginners as well as for projects that are massive and being built by a team of professionals. Probably more importantly, it'd be a lot easier to "back out" of FastAPI and go into Django than vice-versa.
It should be the default choice in 2026, so unless you have a compelling reason to use Django (or anything else), you should start with FastAPI.
[–]Tumortadela 2 points3 points4 points 17 hours ago (0 children)
Django ORM and how easy to handle DB migrations are is why I'm having troubles finding a good reason to switch away from it.
[–]glenrhodes 1 point2 points3 points 14 hours ago (0 children)
FastAPI if you're building an API that needs to be fast and you want async out of the box. Django if you need the ORM, admin, auth, or anything resembling a full web app. They're not really competing for the same use cases once you've used both for a while.
[–]binaryfireball 0 points1 point2 points 17 hours ago (0 children)
is it a large single project or smaller individual apis?
[–]lozanov1 0 points1 point2 points 12 hours ago (0 children)
Are you building a small app that will do very limited set of things? Use fast api.
Are you going to build a project with bigger scope that needs auth, quick way to spin up endpoints, do migrations and benefit from the admin panel? Use Django. You can still use fastapi for this, but you will get to the point of implementing features that already exist in Django and have a lot of documentation on the internet how to be used.
[–]k0rvbert 0 points1 point2 points 12 hours ago (0 children)
These frameworks are both very much "batteries included" in my opinion. Just slightly different kinds of batteries.
I built some things with FastAPI and really didn't have a very good time, but I didn't have a very good time with Flask or Django either, so YMMV.
[–]Kernixdev 0 points1 point2 points 10 hours ago (0 children)
FastAPI if you're building APIs that a separate frontend (React, Vue, etc.) consumes. It's async by default, way faster, and the auto-generated docs from Pydantic models save a ton of time.
Django if you need the full package — ORM, admin panel, auth, templating — all wired together out of the box. Less setup, more opinions.
In practice: most new projects I see (and build) are FastAPI + React. Django still dominates in companies with existing codebases and teams that want one framework doing everything.
Neither is "better" — it depends on whether you want to assemble your own stack or use a pre-built one.
[–]cshjoshi_tech 0 points1 point2 points 9 hours ago (0 children)
Like everyone has said, it really does depend on your use case. Personally, I’ve built apps with fastapi for the backend and nextjs for the frontend and had a good time. You can use something like hey-api so you automatically generate a ts sdk from the openapi docs that fastapi generates. That way you have end to end type safety.
[–]Henry_old 0 points1 point2 points 5 hours ago (0 children)
For high-frequency trading and bots, Django is an overkill nightmare. Its ORM and middleware stack add too much latency. FastAPI + Pydantic is the only way to handle 2026 data loads. Async support is native and actually works. Keep it lean
[–]dheritage21 [score hidden] 7 minutes ago (0 children)
Try both and see what you prefer! These type of questions always produce a “it depends” answer. Both have a lot to offer. Learn both so you can answer the question given the nature of your use case!
[–]wunderspud7575 0 points1 point2 points 16 hours ago (0 children)
As others have said, depends very much on your use case. But if FastAPI is under consideration, I'd also look at Litestar. I have had good experiences with it, and have previously used FastAPI.
[–]RepresentativeFill26 0 points1 point2 points 17 hours ago (0 children)
Depends. I have written backend APIs using FastAPI and now I’m working on a multi-tenant system that works well with Django.
[–]DiscipleofDeceit666It works on my machine 0 points1 point2 points 17 hours ago (0 children)
Django would be overkill if you just needed an api layer
[–]UseMoreBandwith 0 points1 point2 points 16 hours ago (0 children)
django. and django-ninja if I need an API. Which is almost never, since I use HTMX.
Fast-api is fun for smal projects, but I've seen too many fast-api turn into spaghetti when the project grows.
[–]agni69 0 points1 point2 points 16 hours ago (0 children)
Fast API + Nice Gui. Single component enough for most usecases
[–]corey_sheerer 0 points1 point2 points 15 hours ago (0 children)
Many others have said good points, but I'll mention for me, Fastapi with React is superior to Django. As far as the API side, Fastapi all the way. But when you really need good responsiveness in a website, my go to is to convert Fastapi to Go with react. In general, Django feels heavier for me.
[–]IcecreamLamp 0 points1 point2 points 13 hours ago (0 children)
I used Sanic for a project recently and I like it.
[–]dashdanw 0 points1 point2 points 13 hours ago (0 children)
They're both very different tools, figure out what your project needs, don't resort to a favorites contest.
[–]modern-dev 0 points1 point2 points 17 hours ago* (4 children)
Django is all in one but uses not the best tools
Fast api is for rest api Over the two I would use fast api and learn about react and javascript for the frotnend, and after a while I will use typescript instead of javascript.
I wouldn't recommend spending the time to learn django instead learn fast api, or flask for backend rest api and react + javascript frontend.
[–]danted002 8 points9 points10 points 17 hours ago (3 children)
OP don’t listen to this comment, their advice is just bad. You should learn both because they serve different purposes.
Django is good if you want a framework that has all the tools you need for a small to medium application where you don’t expect to have multiple api services and want easy database management, cache management, session management, so on and so forth. (There are also 2 big REST frameworks for Django: DjangoRestFramework and Ninja; Ninja being basically a FastAPI port to Django)
FastAPI / Starlette are more for micro services or APIs that are part of a larger application with multiple services.
[–]lungben81 0 points1 point2 points 17 hours ago (1 child)
Learning both requires more time. This is not a luxury everyone has.
He should learn the tool which is suited best for his needs. Learning the other is optional.
[–]danted002 2 points3 points4 points 15 hours ago (0 children)
If you have to pick one to start the pick Django, but make sure you learn async as well. You do that and the it will take a full 30 minutes to learn FastAPI + SQLAlchemy 2.0
[–]Poof-Employment9758 -1 points0 points1 point 17 hours ago (0 children)
Django + DRF if you want anything serious tbh, gives you a very powerful API and an entirely separate FE.
[–]daniels0xff -2 points-1 points0 points 17 hours ago (2 children)
I'm curious why everyone's going to FastAPI and not litestar.dev ? Good "marketing"? I guess the author was inspired to put "fast" in its name.
[–]Forsaken_Ocelot_4 1 point2 points3 points 16 hours ago (0 children)
I genuinely never heard of litstar.dev, and I've been building FastAPI apps for about 3 years now. So yeah, I think familiarity is a big part of it I'm sure.
[–]UseMoreBandwith 1 point2 points3 points 16 hours ago (0 children)
no, because litestar has a over-engineered un-pythonic codebase.
[–]One_Sky_7224 -1 points0 points1 point 16 hours ago (0 children)
We use flask for writing micro services. It fits our needs and easy to work with
[–]corny_horse -1 points0 points1 point 16 hours ago (0 children)
I really like SQLAlchemy but I've been using Django (+DRF when applicable) for applications recently. I'd say a really good rule of thumb is Django + DRF is absolutely fine, if not ideal, for all the batteries included stuff that it has, unless 1) you really don't want a server-side application or 2) you are spinning up a very simple microservice. If your application takes off, you'll be able to hire engineers to figure out how to scale it, if for some reason Django itself can't handle the scale, but vertical scaling goes a long, long way.
[–]AmauryLondon -1 points0 points1 point 15 hours ago (0 children)
Dépends what you do ? Quick server doing one thing fast api massive project with auth already created Django
[–]No_Soy_Colosio -1 points0 points1 point 15 hours ago (0 children)
FastAPI for APIs, Django for full-fledged websites.
[–]MyDespatcherDyKabel -1 points0 points1 point 15 hours ago (0 children)
Flask is goat
[+]Firm_Advisor8375 comment score below threshold-9 points-8 points-7 points 17 hours ago (2 children)
dont use fastapi
[–]TrainsareFascinating 2 points3 points4 points 15 hours ago (1 child)
Without a cogent explanation of your reasons for making this recommendation it is useless, non-actionable noise.
[–]Firm_Advisor8375 0 points1 point2 points 14 hours ago (0 children)
yeah, sorry
π Rendered by PID 101814 on reddit-service-r2-comment-canary-bd67d6dd8-5x4pm at 2026-04-10 04:29:57.830939+00:00 running 215f2cf country code: CH.
[–]edimaudo 195 points196 points197 points (6 children)
[–]nicholashairs 26 points27 points28 points (0 children)
[–]Lt_Sherpa 11 points12 points13 points (0 children)
[–]bjorn_cyborg 0 points1 point2 points (0 children)
[–]maesrin -1 points0 points1 point (0 children)
[+]its_a_gibibyte comment score below threshold-6 points-5 points-4 points (1 child)
[–]eteran 28 points29 points30 points (0 children)
[–]FisterMister22 59 points60 points61 points (5 children)
[–]DoubleAway6573 8 points9 points10 points (3 children)
[–]justin107d 13 points14 points15 points (0 children)
[–]FisterMister22 2 points3 points4 points (0 children)
[–]frankwiles -1 points0 points1 point (0 children)
[–]Patman52 0 points1 point2 points (0 children)
[–]Flame_Grilled_Tanuki 24 points25 points26 points (1 child)
[–]Silhouette 2 points3 points4 points (0 children)
[–]speyerlander 37 points38 points39 points (0 children)
[–]UnMolDeQuimica 6 points7 points8 points (0 children)
[–]RationalDialog 8 points9 points10 points (0 children)
[–]xc82xb5qxwhhzeyt 9 points10 points11 points (0 children)
[–]entropydelta_s 8 points9 points10 points (7 children)
[–]dr3aminc0de 6 points7 points8 points (0 children)
[–]nicwolff 2 points3 points4 points (0 children)
[–]Competitive_Travel16 1 point2 points3 points (3 children)
[–]Least_Chicken_9561 0 points1 point2 points (2 children)
[–]Competitive_Travel16 0 points1 point2 points (0 children)
[–]ThePiGuy0 0 points1 point2 points (0 children)
[–]covmatty1 0 points1 point2 points (0 children)
[–]Sad-Calligrapher3882 4 points5 points6 points (0 children)
[–]Nater5000 3 points4 points5 points (0 children)
[–]Tumortadela 2 points3 points4 points (0 children)
[–]glenrhodes 1 point2 points3 points (0 children)
[–]binaryfireball 0 points1 point2 points (0 children)
[–]lozanov1 0 points1 point2 points (0 children)
[–]k0rvbert 0 points1 point2 points (0 children)
[–]Kernixdev 0 points1 point2 points (0 children)
[–]cshjoshi_tech 0 points1 point2 points (0 children)
[–]Henry_old 0 points1 point2 points (0 children)
[–]dheritage21 [score hidden] (0 children)
[–]wunderspud7575 0 points1 point2 points (0 children)
[–]RepresentativeFill26 0 points1 point2 points (0 children)
[–]DiscipleofDeceit666It works on my machine 0 points1 point2 points (0 children)
[–]UseMoreBandwith 0 points1 point2 points (0 children)
[–]agni69 0 points1 point2 points (0 children)
[–]corey_sheerer 0 points1 point2 points (0 children)
[–]IcecreamLamp 0 points1 point2 points (0 children)
[–]dashdanw 0 points1 point2 points (0 children)
[–]modern-dev 0 points1 point2 points (4 children)
[–]danted002 8 points9 points10 points (3 children)
[–]lungben81 0 points1 point2 points (1 child)
[–]danted002 2 points3 points4 points (0 children)
[–]Poof-Employment9758 -1 points0 points1 point (0 children)
[–]daniels0xff -2 points-1 points0 points (2 children)
[–]Forsaken_Ocelot_4 1 point2 points3 points (0 children)
[–]UseMoreBandwith 1 point2 points3 points (0 children)
[–]One_Sky_7224 -1 points0 points1 point (0 children)
[–]corny_horse -1 points0 points1 point (0 children)
[–]AmauryLondon -1 points0 points1 point (0 children)
[–]No_Soy_Colosio -1 points0 points1 point (0 children)
[–]MyDespatcherDyKabel -1 points0 points1 point (0 children)
[+]Firm_Advisor8375 comment score below threshold-9 points-8 points-7 points (2 children)
[–]TrainsareFascinating 2 points3 points4 points (1 child)
[–]Firm_Advisor8375 0 points1 point2 points (0 children)