Quick Overview: Django REST API in 2021

Gustav Willig
2 min readApr 11, 2021

--

Django REST Framework, Source: https://www.django-rest-framework.org/

Django REST framework (DRF)is a powerful and flexible toolkit for building Web APIs. DRF is an toolkit for the Django library.

What is Django?

Django is a Python-based, free, open-source web framework that follows the model-template-views architectural pattern (If you want to find out what the current state of Django is 2021 please read my previous article https://gustavwillig.medium.com/is-django-in-2021-still-relevant-78848c5b8d59)

What is a REST API?

REST APIs are one of the most common kinds of web services available today, to expose useful functions and data. In general Representational state transfer (REST) is a software architectural style which uses a subset of HTTP. So if a web serivce follows the guidelines of REST, it can be called RESTful.

6 guiding constraints define a RESTful system:

  1. Client–server architecture
  2. Statelessness
  3. Cacheability
  4. Layered System
  5. Uniform interface
  6. Code on Demand (optional)

(see https://en.wikipedia.org/wiki/Representational_state_transfer)

Why using a REST

One of the key advantages of REST APIs is that they provide a great deal of flexibility. Data is not tied to resources or methods, so REST can handle multiple types of calls, return different data formats and even change structurally with the correct implementation of hypermedia. Other advantages are:

  • Scalability: The clear separtion between client and server makes it a lot easier to scale an application. Also its built upon a HTTP protocol and its stateles. Stateless means it wont share anything between other request. So any request can go to any Server in a load balanced cluster. There is nothing forcing this user request go to this server
  • Flexibility: You can use any kind of front-end library for your view and because backend and frontend is clearly seperated you can easly switch to another frontend technology.

Best resource in 2021 to learn DRF

Good look for your next project.

--

--

Gustav Willig
Gustav Willig

Written by Gustav Willig

An AI Full-Stack Developer with a passion for using data to drive business decisions. Get your latest news about Django and AI trends by subscribing

No responses yet