Django Ninja - The new DRF killer?! 🥷
Vložit
- čas přidán 8. 08. 2024
- Django Ninja is getting a lot of attention online.
I show you how to build a simple API, with built in docs, using Django Ninja (a package for Django).
(Spoiler: such a nice way to create APIs FAST!)
✍️ Check out my other written guides here: www.photondesigner.com/articl... - Jak na to + styl
Well the code part is similar to using the Response of DRF and thus removing the need for a serializer... Doesn't look like a stellar upgrade to get to or am I missing something here?
There are quite a few nice Django Ninja features v DRF: check out this Jayesh: django-ninja.dev/motivation/
I probably wouldn't switch from DRF to Ninja if I was using DRF. But I would start all new Django APIs with Django Ninja
for people not familiar with python typing , it will seem very hard . learning typing is need to be part of basic (from my exp)
Thanks for the comment. No typing is required!
In case you want to validate data with a schema, and are having difficulties, have you seen the ability to generate a schema from the models with Ninja? (django-ninja.dev/guides/response/django-pydantic/)
No typing required! In case you want validate data with a schema, have you seen django-ninja.dev/guides/response/django-pydantic/
@@aravindr2333 typing is beyond easy
hi thank u Tom for video , Django Ninja it's look like FastAPI
You’re welcome and I agree with you. FastAPI and Django Ninja are quite similar. I like how Django Ninja is focused on Django. Might do a video on FastAPI💨
@@tomdekan Try FastAPI with HTMX ☄
Nice idea :) 🚀
So basically FASTAPI + Django dev tools
Yes + Django ORM integration. Here's a comparison for you Alex: django-ninja.dev/motivation/?h=fastapi
Also async just works. Also, Swagger out of the box at /docs.
Good point. Swagger out of the box is great.
Thanks for the brief intro. what would become of DRF. Serializers 🙂. django-ninja is more straightforward
You're welcome 🙂. True regarding DRF. I've used DRF a lot in production for different products/businesses. I think even the class-based serializers of DRF are unenjoyable to use.
I find DRF's serializers are clunky when you want to avoid duplication. E.g sometimes you might need to get a temporary download link from your object storage, and bolt it onto the serializer.
So, in short, Django Ninja looks like a superior to me.