Preferences

I've been developing in Django with Django Rest Framework for 10+ years and just recently built my first FastAPI project, so I may be a little bit biased here.

Django takes care of a lot of common functionality for you. The biggest things for me are:

- Authentication: this includes safely handling sessions, cookies, password hashes as well as integrations with SSO providers via libraries like Social Django.

- ORM: love it or hate it, the ORM just does everything. You mostly don't need to worry or think about migrations or database support.

- Admin panel: the builtin admin panel is a great way to get a quick UI that can, in some cases, handle a pretty big swath of the UI needs for your app.

With that said, there are some things that I LOVED about FastAPI. Using pydantic for serialization is way nicer than the serializers you get from Django Rest Framework. The DRF serializers just feel slow and antiquated after using pydantic. FastAPI is also much lighter weight, and works great if you just need a quick and dirty API server.

I think that my recommendation would be to use FastAPI for microservices and Django for anything that needs to handle more than a few REST API endpoints. All the extra functionality in Django is great if you want to build a production monolith, but all those extra features are unnecessary bloat for microservices.


I agree, about the admin in particular because its something a lot of frameworks do not have.

I have used DRF in the past but I am a bit worried about it future. Discussion here: https://www.hackerneue.com/item?id=43510495

Django Ninja looks promising.

This item has no comments currently.

Keyboard Shortcuts

Story Lists

j
Next story
k
Previous story
Shift+j
Last story
Shift+k
First story
o Enter
Go to story URL
c
Go to comments
u
Go to author

Navigation

Shift+t
Go to top stories
Shift+n
Go to new stories
Shift+b
Go to best stories
Shift+a
Go to Ask HN
Shift+s
Go to Show HN

Miscellaneous

?
Show this modal