3 ms·
Or just use django-ninja if you are writing an API. Maybe it's just because I came from teams that used tornado and then fastapi but when I started using django
by jerrygenser 3y ago
Or just use django-ninja if you are writing an API. Maybe it's just because I came from teams that used tornado and then fastapi but when I started using django which was about 8 months ago, I simply grabbed django-ninja and haven't thought much about it. It seems like everything in this article would be solved by using a simpler interface for writing endpoints with body parsing, output schemas, and url parsing.
https://django-ninja.rest-framework.com/ https://django-ninja.rest-framework.com/
- winrid 3y agoThe article isn't really about APIs. If you're writing APIs, most people will reach for DRF. Ninja looks neat, though.
- xwowsersx 3y agoHow does Django Ninja compare to Django Rest Framework (DRF)? Is there much of a difference in terms of performance?
- jerrygenser 3y agoDjango ninja performs better primarily due to relying on pydantic for parsing and validating requests. In a high throughput scenario that's going to be the primary CPU bound area. However usually network or file io is going to be a limiting factor far before CPU. Django ninja also is build with async in mind fron the start so immediately opens up possibilities that are not possible with DRF. Seems like as of 4mo ago the maintainers of DRF added async support via a separate module.
- xwowsersx 3y agoThanks very much for the reply. I actually had not seen that DRF added async support. I must take a look at that! I'm very curious to know how big of an impact switching to AsyncViews would have. Any experience on that front?
- xwowsersx 3y agoI haven't tested very thoroughly yet, but I'm seeing large improvements in latency and throughput by switching to async views!