Django REST Framework

From Littledamien Wiki
Revision as of 23:32, 2 December 2015 by Video8 (talk | contribs) (Created page with "== Source == > [http://www.django-rest-framework.org/ Django REST framework] '''Question:''' This is not part of Django itself. Are there other solutions out there? == Inst...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Source

> Django REST framework

Question: This is not part of Django itself. Are there other solutions out there?

Installation

Install package with pip. (markdown and django-filter are optional add-ons.)[1]

$ pip install djangorestframework
$ pip install markdown       # Markdown support for the browsable API.
$ pip install django-filter  # Filtering support

Add the rest_framework app to the project:

# settings.py

INSTALLED_APPS = (
    ...
    'rest_framework',
)

To use the browsable REST API, add the login and logout urls:

# urls.py

urlpatterns = [
    ...
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]

Notes

  1. Installation - Django REST framework