Django REST Framework

From Littledamien Wiki
Revision as of 18:56, 4 December 2015 by Video8 (talk | contribs)
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

External Links

References

  1. Installation - Django REST framework