Tuesday, November 19, 2024
Google search engine
HomeLanguagesDjango REST Framework Installation

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

  • Python
  • Pip
  • Django
  • How to install Django REST Framework

    To install Django REST Framework on Windows, Linux or any operating system, one would need pip package. To check how to install pip on your operating system, checkout – PIP Installation – Windows || Linux.
    Now, run a simple command,

pip install djangorestframework

Wait and relax, REST framework would be installed shortly.
django-rest-framework-installation

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.

RELATED ARTICLES

Most Popular

Recent Comments