Django REST Framework: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
(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...")
(No difference)

Revision as of 23:32, 2 December 2015

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