Framework for Implementing REST web service in Django


Question

I'm looking to implement a RESTful interface for a Django application. It is primarily a data-service application - the interface will be (at this point) read-only.

The question is which Django toolsets / frameworks make the most sense for this task.

I see Django-rest and Django-piston. There's also the option of rolling my own.

The question was asked here, but a good two years back. I'd like to know what the current state of play is.

In this question, circa 2008, the strong majority vote was to not use any framework at all - just create Django views that reply with e.g. JSON. (The question was also addressed, crica 2008, here.)

In the current landscape, what makes the most sense?

1
22
5/23/2017 12:02:59 PM

Accepted Answer

NOTE: Since this post was written, django-piston is no longer actively maintained. As others have mentioned, look into tastypie or django-rest-framework.

Indeed, you can roll your own, but there's a lot of boilerplate involved.

django-piston is an exceptionally easy to use, and extensible, micro-framework. In addition to mocking up all the necessary views and url patterns, it supports directly mapping models to a REST interface, which is nice if you have a simple use case. I'd suggest looking into it.

18
8/17/2012 10:09:59 PM

And since this question still rated pretty highly in my searches on Google, I'll add this alternative to the mix: http://django-rest-framework.org/

My initial impression is that it does a very good job of embodying the RESTful API design principles described here: http://readthedocs.org/docs/restful-api-design/en/latest/


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon