Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can Django REST Framework serializers be used for other web-frameworks?

I want to use JSON serilization in my aiohttp.web application. But I haven't found any libraries for that task in aiohttp universe.

If there are any problem to use serilizers from django-rest-ramework with aiohttp?

like image 221
Illia Ananich Avatar asked Sep 01 '25 00:09

Illia Ananich


1 Answers

Django REST framework is very closely tied to django itself. You could probably hack a setup where you were able to use a little of DRF with aiohttp but you would obviously lose most of what DRF does: routing, db/model integration, views, viewsets, authentication.

Much better to use one of the many other serialization and deserialization libraries available in python. I would recommend pydantic (admission: I developed pydantic), but there are loads of other such libraries.

The power of DRF comes from it's completeness and first class integration with django. Without that it's not a good choice. It's also very slow.

like image 154
SColvin Avatar answered Sep 02 '25 14:09

SColvin