Django REST Framework
In this series of tutorials, we will create REST APIs using Django REST Framework (DRF) in python which is one the most popular framework out there. DRF allows you to create REST API in Django, so it won’t create HTML output using templates in Django. You can then consume this REST API in your web app or mobile apps and so there is a clear separation between your UI and Backend.
Why this series of tutorial ?
Ok, so there is already a tutorial series on Django REST Framework site, then why this series ? Official DRF site goes through series of tutorials to go through the DRF concepts. It goes in this sequence :
- Models and Serializers using Serializer class
- Serializers using ModelSerializer class
- Function based Views returning JSONs
- Function based Views with HTTP Request, Response objects and using decorators
- Class based views
- Class based views using Mixins and generic class-based views.
- and few other DRF features.
So if you are trying it first time, it might look difficult to understand and there are quite a few back and forth required between tutorials.
To understand the DRF concepts in detail, Please follow DRF tutorial series. You will need it to use different features provided by DRF.
In this series, we will keep it simple. We will create Models, Serializers using ModelSerializer and Class based Views. We will also cover auto generated browseable API and see options to customize browseable API using a separate library drf-yasg.
You can get all the files related to the examples here : https://github.com/hpin2019/coding-sessions/tree/master/drf-tutorial-1
Let’s start with installation.