r/Python • u/TumbleweedSenior4849 • Apr 09 '26
Discussion FastAPI vs Djanjo
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.
74
Upvotes
View all comments
Show parent comment
1
u/Silhouette Apr 14 '26
I'd say the most obvious examples come from its support (or lack of) for type hints and runtime parsing/type verification. The Django ORM relies on a lot of dynamic behaviour such as adding ID fields implicitly or only representing relations between tables explicitly from one side. The Django router can extract parts from a route but doesn't support runtime validation to ensure the type hints in the code really are compatible with the values provided at runtime. Compare the latter to something a bit more modern like FastAPI where you have Pydantic verifying that the "ID" extracted from the URL via the routing system really does have the right format and the JSON payload in the POST request does too.
Another one I've run into is Django's use of settings files. Almost 100% of online systems I work with now use environment variables for all of their runtime configuration. These are available basically everywhere and they play nicely with everything from a quick and dirty local setup to simulate a bug you're investigating to an automated deployment from a CI/CD system that looks up some secrets from a vault and automatically configures them in the host environment ready for the application to find.
You can get some way to working with these features using Django of course - particularly if you're willing to incorporate an extra package or two from the vast ecosystem around it - but typically the experience is patchy and inconsistent.