Django REST Framework: Difference between revisions

From Littledamien Wiki
Jump to navigation Jump to search
No edit summary
 
Line 2: Line 2:


> [http://www.django-rest-framework.org/ Django REST framework]
> [http://www.django-rest-framework.org/ Django REST framework]
== Comparison with other packages ==


'''Question:''' This is not part of Django itself. Are there other solutions out there?
'''Question:''' This is not part of Django itself. Are there other solutions out there?
'''A:''' [https://django-tastypie.readthedocs.org/en/latest/ TastyPie]
[http://stackoverflow.com/questions/7303313/what-are-the-differences-between-django-tastypie-and-djangorestframework What are the differences between Django REST Framework and TastyPie?] - Stackoverflow
Also, Flask has built-in REST support which is said to be able to do things that Django REST Framework can't, e.g. combine queries like `http://mysite.com/api/model1/filters/api/model2/filters`


== Installation ==
== Installation ==

Latest revision as of 00:23, 5 December 2015

Source[edit]

> Django REST framework

Comparison with other packages[edit]

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

A: TastyPie

What are the differences between Django REST Framework and TastyPie? - Stackoverflow

Also, Flask has built-in REST support which is said to be able to do things that Django REST Framework can't, e.g. combine queries like http://mysite.com/api/model1/filters/api/model2/filters

Installation[edit]

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[edit]

External Links[edit]

References[edit]

  1. Installation - Django REST framework