[Fixed]-Django + AngularJS: REST-like endpoints without the Django REST framework using plain URLs and views?

1👍

I am not a fun of DRF but I’ve been using it in a couple of projects lately. The answer to most of your questions is application-dependent, that meaning size and type of your webapp matter.

For what I took away from using DRF it could give you a boost on:

  • Objects serialization (and validation): I think it’s much easier (avoids typing) making the serializers thru’ DRF instead of building them in Django. While models and querysets and usually easy done, if you need some more structured JSON response the DRF layer to support the serialization helps.
  • Permissions and authentication: being addressed to REST APIs there are good shourtcuts to provide security and restrict access to methods, both in terms of methods type and user permissions checking.
  • Plugins: if you have to deal (you’ll probably do) with CORS and/or token-based authorization there are a bunch of niceties you can plug into DRF to get the work done. I am not sure it is that straightforward to put them in place direcly in Django.

That said the CONS:

  • If you start by using the high-level interfaces of DRF (Viewsets, Routers and the like) you’ll eventually end-up refactoring a little bit to address specific needs for which you’ll need more control over the code.
  • As Django is already a quite big ecosystem, DRJ adds’up to the steepness of the learning curve, probably slowing down a little the implementation, at first.
  • Don’t know about the performances of the requests passing thru’ DRF, but I wouldn’t care that much unless your app has specific requirements. DRF wan’t probably add up much on well-written code (…and queries to the DB).

These were my two cents. Hope it helps.

👤steppo

Leave a comment