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:
- Client–server architecture
- Layered System
- Uniform interface
- Code on Demand (optional)
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
- Tutorial on Django REST framework website: https://www.django-rest-framework.org/tutorial/quickstart/
- Real Python: https://realpython.com/django-rest-framework-quick-start/
- Digtial Ocean: https://www.digitalocean.com/community/tutorials/build-a-to-do-application-using-django-and-react
Good look for your next project.