Django REST framework is a lightweight REST framework for Django, that aims to make it easy to build well-connected, self-describing RESTful Web APIs.
Browse example APIs created with Django REST framework: The Sandbox
Features:
Project hosting: GitHub.
Any and all questions, thoughts, bug reports and contributions are hugely appreciated.
You can install Django REST framework using pip or easy_install:
pip install djangorestframework
Or get the latest development version using mercurial or git:
hg clone https://bitbucket.org/tomchristie/django-rest-framework
git clone git@github.com:tomchristie/django-rest-framework.git
Or you can download the current release.
To add Django REST framework to a Django project:
For more information on settings take a look at the Setup section.
Using Django REST framework can be as simple as adding a few lines to your urlconf.
urls.py:
from django.conf.urls.defaults import patterns, url
from djangorestframework.resources import ModelResource
from djangorestframework.views import ListOrCreateModelView, InstanceModelView
from myapp.models import MyModel
class MyResource(ModelResource):
model = MyModel
urlpatterns = patterns('',
url(r'^$', ListOrCreateModelView.as_view(resource=MyResource)),
url(r'^(?P<pk>[^/]+)/$', InstanceModelView.as_view(resource=MyResource)),
)
Django REST framework comes with two “getting started” examples.
There are a few real world web API examples included with Django REST framework.
All the examples are freely available for testing in the sandbox:
(The Sandbox Root API resource is also documented.)