4 ms·
Why? The FastAPI library ecosystem is anemic. Django is fast enough. You'll be spending at most a fraction of an FTE salary in hosting even with the best of su
by Daishiman 6y ago
Why? The FastAPI library ecosystem is anemic.
Django is fast enough. You'll be spending at most a fraction of an FTE salary in hosting even with the best of success, and if it comes to more than that, you'll be likely paying for a DBA or for an improved caching strategy for performance.
- travisjungroth 6y ago> The FastAPI library ecosystem is anemic. That's kinda the point. If your business is making webapps for clients, the fact that you can pip install django-half-the-feature is awesome. What you trade for that is a big dependency tree whose packages sometimes snake their way through your whole codebase, since it's all Django anyway. FastAPI is its own thing, but it's also heavily based on some other big libraries that also have their own support. And anyway, what I was saying about performance and decoupling are probably just rationalizations. I focus on writing APIs, and that looks nicer to do in FastAPI than how I've done it in Django. I also really like type hinting, and that's a big part of things. Right now, I'd just like to write more Python and less Django.
- ryanisnan 6y agoThe biggest challenge I encountered when doing this exact thing was once you get beyond bootstrapping the project, and start implementing your first feature. Great, you need an ORM, what do you choose? Now you need a serializer, what do you choose? What about validation, what do you choose? Authentication, what do you choose? A lot of these questions are boring and are not worth spending time thinking about. Almost all choices will leave you with some amount of headaches though (as will choosing Django). The question to me boils down to... what questions am I interested in solving?
- travisjungroth 6y agoBy "doing this exact thing" do you mean making an API with FastAPI? Because you seem unfamiliar with its features. > Great, you need an ORM, what do you choose? SQLAlchemy. It's very popular. > Now you need a serializer, what do you choose? Pydantic, which is included. (Django doesn't include serializers). > What about validation, what do you choose? Pydantic. > Authentication, what do you choose? The included auth library.
- ryanisnan 6y agoIn a couple of attempts, I have worked with Flask and Falcon. My point isn't that there are solutions, my point is that you have to make decisions, all of which are likely to have rough edges.
- travisjungroth 6y agoAnd my point is that for your specific examples, you don't have to make decisions. Django and FastAPI both have 3/4 of the features you listed included. FastAPI is a tool made for making APIs. Django is not. So in that specific case, Django actually requires more decisions overall.
- Daishiman 6y agoDjango Rest Framework is the one-stop shop for APIs. Probably the most deployed API framework ever.
- travisjungroth 6y agoDRF to FastAPI is a more direct comparison. DRF is what I spent most of my Django time in. And if you like DRF, the author (Tom Christie) wrote Starlette. FastAPI is based on Starlette.