Build a Django Rest API with the Django Rest Framework. Complete Tutorial. There’s a lot to cover so be sure to checkout the chapters below.
Thanks to Algolia.com for the sponsorship and helping make this series possible!
Tutorial Code: https://github.com/codingforentrepreneurs/Django-Rest-Framework-Tutorial
Setup Links
– macOS Setup Blog Post: https://www.codingforentrepreneurs.com/blog/install-django-on-mac-or-linux/
– maOS Setup Playlist: https://www.youtube.com/watch?v=C47c0TXrS-8&list=PLEsfXFp6DpzSP0VAiEgPg0a-A04sa3rkr
– Windows Setup Blog Post: https://www.codingforentrepreneurs.com/blog/install-python-django-on-windows/
– Windows Setup Playlist: https://www.youtube.com/watch?v=gmuu4swNGSk&list=PLEsfXFp6DpzQ33Q5xhD5naEV9K-Z6upZw)
– Linux Setup Blog Post: https://www.codingforentrepreneurs.com/blog/install-django-on-linux-ubuntu/
Links:
– Django: https://www.djangoproject.com/
– Django Rest framework: https://www.django-rest-framework.org/
– Python Requests: https://docs.python-requests.org/en/latest/
– VSCode: https://code.visualstudio.com/
– Python: https://www.python.org/
– Httpbin : https://httpbin.org
– algoliasearch-django package: https://github.com/algolia/algoliasearch-django
– Python JWT Client https://www.codingforentrepreneurs.com/blog/python-jwt-client-django-rest-framework-simplejwt
– Django Cors Headers https://pypi.org/project/django-cors-headers/
– Algolia InstantSearch.js https://www.algolia.com/doc/guides/building-search-ui/what-is-instantsearch/js/
00:00:00 Welcome to the Django Rest Framework
00:01:54 Tools we are using
00:04:36 Setup Python Virtual Environment, Install Req, and Start Django
00:11:40 Creating a Python API Client
00:27:01 Run Django Project
00:31:16 Create your first API View
00:37:06 Echo GET Data
00:47:10 Django Model Instance as API Response
00:54:45 Django Model Instance to Dictionary
01:00:41 Rest Framework View & Response
01:04:27 Django Rest Framework Model Serializers
01:14:45 Ingest Data with Django Rest Framework Views
01:27:05 Django Rest Framework Generics RetrieveAPIView
01:35:54 Django Rest Framework CreateAPIView
01:41:57 Django Rest Framework ListAPIView & ListCreateAPIView
01:44:36 Using Function Based Views For Create Retrieve or List
01:55:17 UpdateAPIView & DestroyAPIView
02:04:05 Mixins and a Generic API View
02:16:33 Session Authentication & Permissions
02:23:21 User & Group Permissions with DjangoModelPermissions
02:30:55 Custom Permissions
02:45:46 Token Authentication
02:59:45 Default Django Rest Framework Settings
03:07:39 Using Mixins for Permissions
03:13:15 ViewSets & Routers
03:25:51 URLs, Reverse, & Serializers
03:33:47 Model Serializer Create & Update Methods
03:41:47 Custom Validation with Serializers
03:53:04 Request User Data & Customize View Queryset
04:08:44 Related Fields & Foreign Key Serializer
04:24:30 Pagination
04:32:36 A Django Based Search for our Product API
04:48:34 Building your Search Engine on Algolia
05:09:54 Agolia Search Client for Django
05:30:22 Unified Design of Serializers & Indices
05:46:48 JSON WEB Token Authentication with simplejwt
06:00:30 Login via JavaScript Client
06:16:23 Handle Request Blocked by CORS via django cors headers
06:23:53 Using JWT with JS Client
06:39:54 Search via REST API & JS Client
06:48:40 Algolia InstantSearch.js
07:00:35 Thank you and next steps
source
Thanks for watching! Code: https://github.com/codingforentrepreneurs/Django-Rest-Framework-Tutorial
Chapters:
00:00:00 Welcome to the Django Rest Framework
00:01:54 Tools we are using
00:04:36 Setup Python Virtual Environment, Install Req, and Start Django
00:11:40 Creating a Python API Client
00:27:01 Run Django Project
00:31:16 Create your first API View
00:37:06 Echo GET Data
00:47:10 Django Model Instance as API Response
00:54:45 Django Model Instance to Dictionary
01:00:41 Rest Framework View & Response
01:04:27 Django Rest Framework Model Serializers
01:14:45 Ingest Data with Django Rest Framework Views
01:27:05 Django Rest Framework Generics RetrieveAPIView
01:35:54 Django Rest Framework CreateAPIView
01:41:57 Django Rest Framework ListAPIView & ListCreateAPIView
01:44:36 Using Function Based Views For Create Retrieve or List
01:55:17 UpdateAPIView & DestroyAPIView
02:04:05 Mixins and a Generic API View
02:16:33 Session Authentication & Permissions
02:23:21 User & Group Permissions with DjangoModelPermissions
02:30:55 Custom Permissions
02:45:46 Token Authentication
02:59:45 Default Django Rest Framework Settings
03:07:39 Using Mixins for Permissions
03:13:15 ViewSets & Routers
03:25:51 URLs, Reverse, & Serializers
03:33:47 Model Serializer Create & Update Methods
03:41:47 Custom Validation with Serializers
03:53:04 Request User Data & Customize View Queryset
04:08:44 Related Fields & Foreign Key Serializer
04:24:30 Pagination
04:32:36 A Django Based Search for our Product API
04:48:34 Building your Search Engine on Algolia
05:09:54 Agolia Search Client for Django
05:30:22 Unified Design of Serializers & Indices
05:46:48 JSON WEB Token Authentication with simplejwt
06:00:30 Login via JavaScript Client
06:16:23 Handle Request Blocked by CORS via django cors headers
06:23:53 Using JWT with JS Client
06:39:54 Search via REST API & JS Client
06:48:40 Algolia InstantSearch.js
07:00:35 Thank you and next steps
Everything was perfect until Session Authentication & Permissions. Wtf bro you completely lost me there.
Yo I like this tutorial, appreciate you really dive in and be thorough with all the moving parts of Django and Rest framework and not just making an app like all the other video does!
is knowledge about Django needed for this Django REST framework ?
excellent 💟
Wow this is so thorough!
1:10:00 -> changing the field name
Amazing video tutorial. Thanks!
This is indeed a very good tutorial
Well explanation at all!!
2:03:00 watched till here
awesome man thanks
new to your channel, i wish this tutorial opened with "try django 3.2" rather than mentioning it an hour in. i'll go watch that and then come back here.
Great tutorial though, earned a sub!
data scrapping- 18:31
amazing tutorial
1:55:18
❗⭐Justin Mitchell: let me go round and round explaining 27 different things that aren't of much use and confuse you utterly and then I'll explain the crux⭐❗
you are incredible teacher, thank you!
you are the best 💪
Hi, I have a problem. It just doesn't work for me for whatever reason. The pagination doesn't show, and it's exactly the way it was before despite me adding pagination. I checked a few times and i copied it correctly from the there is no error. id don't understand why
way too fast, also it's nice to update the github from topic to topic, cause it's hard to follow like this
4:03:56 Why is printed data duplicated as many times as objects in resulting list? I don't get it. And is there a way to optimize that?
I really like it. I like the serializers part, I didn't get it at first from the documentaion.
Thanks for the amazing demonstration.
This dude is awesome!
This is bad advice at https://youtu.be/c708Nf0cHrs?t=7042. You absolutely need to save the instance otherwise you're just returning the updated instance, and the changes won't persist in the database.
man tnk u so much for creating because it really teaches me a lot about drf api and some other part of django that i am lacking, loved it so much, i am done with the vid
django does not seem very simple. multiple options to do same thing and limitation of each option is not obvious.
great job justin, thanks for sharing
01:35:53
What an amazing content!
Nothing happens when I run pip install -r requirements.txt
Tried pip3 install -r requirements.txt too
You are going waaay too fast, it's better to have less content but better explained, than put everything there but poorly explained because of constant rushing somewhere, it's like you are just waiting to finish it..The real value of a tutorial is measured by how well you explained the content, not the amount of information said in it…Really becomes painful to watch at some point, cause you say 1 thing, but skip 4, and in order to understand the topic you need to know all 5… I'm not saying this video is bad, there is a lot of good information here, but if you really want to know and understand this topic, this is just not enough, too many holes in explaining
this tutorial is going over my head
Thanks for this tutorial, this has so much great information.
thanks for putting efforts for us <3 (not gay)
I was following the tutorial but encountered a problem in echoing the GET data because maybe I was using the latest versions of Django and DRF. In the video my, body = request.body has an empty output when you print it outputs b'' ". I need help on this !!
What do ya know!!! Thanks big man 💎