Step into Django REST Framework

To build a web application with Python, the most popular language nowadays, many frameworks can choice,

such as Django, Flask, Torando and else. They have different natures and goal to be used by the project needs.

However, if you want a framework with highly modules decoupling design and strong ‘self-support’ featured plugins,

then Django would be the answer, since the popularity and experience, you can find great support from community.

Since the widely use of the single-page applications with JS, that greatly improve speed and reactions of pages,

the API framework for Django called Django REST framework(DRF) was also published in 2011.

There are the flowchart and compulsory components to build a basic REST API server of this framework.

Basic flowchart:

drf-call-handling

Compulsory components:

  • Request: Extended from the Django HttpRequest, the start of handling incoming REST calls

  • Responses: Differed from Django HttpResponse, which can return the data with requested content types

  • View: Provides request handler methods for different REST calls, then return response

  • Serializer: Module for conversion between Python datatypes and formatted content type(JSON, XML)

  • Authentication: Identifies the user credentials that the request was made with, handles at the start of the view

  • Permissions: Means authorization after authentication, that grant or deny access for groups to the APIs

Comments