What are the differences between django-tastypie and djangorestframework? [closed] What are the differences between django-tastypie and djangorestframework? [closed] django django

What are the differences between django-tastypie and djangorestframework? [closed]


As the author of django-rest-framework, I've got an obvious bias ;) but my hopefully-fairly-objective opinion on this is something like:

TastyPie

  • As Torsten noted, you're not going to go far wrong with something written by the same peeps as the awesome django-haystack. From what I've seen on their mailing list Daniel Lindsey et al are super-helpful, and Tastypie is stable, comprehensive and well documented
  • Excels in giving you a sensible set of default behaviour and making building an API with that style incredibly easy.

Django REST framework

  • Gives you HTML browse-able self-describing APIs. (EG, see the tutorial API.) Being able to navigate and interact with the API directly in the browser is a big usability win.
  • Tries to stay close to Django idioms throughout - built on top of Django's class based views, etc... (Whereas TastyPie came along before Django's CBVs existed, so uses it's own class-based views implementation)
  • I'd like to think that the underlying architecture is pretty nicely built, decoupled etc...

In any case, both are good. I would probably characterise Tastypie as giving you a sensible set of defaults out of the box, and REST framework as being very nicely decoupled and flexible. If you're planning on investing a lot of time in the API, I'd def recommend browsing through the docs & codebase of each and trying to get a feel for which suits you more.

Obviously, there's also the 'Why TastyPie?' section in it's README, and the 'REST framework 3'.

See also Daniel Greenfeld's blog post on Choosing an API framework for Django, from May 2012 (Worth noting that this was still a few months before the big REST framework 2.0 release).

Also a couple of threads on Reddit with folks asking this same question, from Dec 2013 and July 2013.


Both are good choices.

For filters, tastypie is more powerful out-of-the-box. If you have a view that exposes a model, you can do Django-style inequality filters:

http://www.example.com/api/person?age__gt=30

or OR queries:

http://www.example.com/api/mymodel?language__in=en&language__in=fr

these are possible with djangorestframework, but you have to write custom filters for each model.

For tracebacks, I've been more impressed with django-rest-framework. Tastypie tries to email settings.ADMINS on exceptions when DEBUG = False. When DEBUG = True, the default error message is serialised JSON, which is harder to read.


EDIT Outdated answer, tastypie is not really maintained anymore. Use Django REST framework if you have to choose a framework to do REST.

For an overview about the actual differences between both of them you should read their documentation. They are both more or less complete and quite mature.

I personally tend to tastypie though. It seems to be easier to set it up. It's done from the same people which created django-haystack which is awesome and according to django-packages it is used more than Django REST framework.