Setting Up Django Rest Framework

Setting Up Django Rest Framework

ยท

2 min read

Django Rest Framework (DRF)

Django framework is a powerful toolkit for building web API's

its comes with many interesting features which include:

  • a web_browsable_api
  • serialization that supports ORM

an API(application programming interface) gives us data when requests are sent to it.

this data is usually in the form of JSON(JavaScript Object Notation).

yes, it is not only for javascript

Django rest framework(DRF) helps us customize the requests handling and the outputs down to status codes.

to install it Django and python is required

python -m venv env
  • to create a virtual environment
pip install django
  • install django
pip install djangorestframework Markdown django-filter
  • install django rest framework
django-admin startproject api
  • start a django project

  • change directory to api/api

  • open settings.py

  • under installed apps

  • add the following lines to the end of the list

"rest_framework",
"rest_framework.authtoken"

change directory to the root api

python manage.py migrate
python manage.py runserver