Open In App

Django REST Framework Installation

Django REST Framework can be installed via pip package similar to Django installation. Since Django REST Framework is a wrapper over default Django Framework, to install it, Django should be installed already. Now to install rest framework follow the below process.

Prerequisites

pip install djangorestframework

Wait and relax, REST framework would be installed shortly.

Install Django REST Framework using Source code

One can install Django REST Framework, using source code directly, install git command line utility first, then



git clone https://github.com/encode/django-rest-framework

after cloning, it add it to bin directory where django is installed.

Add rest_framework to INSTALLED_APPS

For Django REST Framework to work on top of Django, you need to add rest_framework in INSTALLED_APPS, in settings.py.

INSTALLED_APPS = (
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'rest_framework'
)

Bingo..!! Django REST Framework is successfully installed, one case use it in any app of Django.

Article Tags :