Bummer! This is just a preview. You need to be signed in with a Basic account to view the entire video.
In this video, you'll get a look at what Django REST Framework does, what it provides to make development easier, and an idea of what you’ll be building.
The official site for Django REST Framework is amazingly useful and I'll be referencing it all through the course. It's a good idea to take a look around and keep it open for a quick reference while doing this course and its code challenges.
[MUSIC] 0:00 Hi I'm Kenneth a Django teacher here at Treehouse. 0:04 Before I became a teacher I was a full time Django developer and 0:08 one of my favorite tools was Django rest framework. 0:11 What is Django rest framework? 0:14 Djingo rest framework which you'll hear called DRF or even DRF for 0:16 short is a powerful and flexible framework that sits on top of Django. 0:20 DRF is used for building RESTful Web APIs. 0:25 Like Django DRF provides a lot of useful tools out of the box that make developing 0:27 APIs a lot easier. 0:32 I can hear you saying it, can't I just build an API with Django? 0:34 You can absolutely. 0:37 DRF, however helps you to do a lot of things faster and smarter. 0:38 For example DRF's model serializer which is very similar to Django's model forms 0:43 makes turning your query sense into JSON a breeze. 0:48 Manually turning a Django query into Json isn't hard, but do it yourself and 0:51 you'll find things like foreign keys or file fields become a bit of a headache. 0:54 Also, out of the box, DRF can handle token based authentication. 0:59 Again, Django is more than capable of token based off, 1:03 but you'll have to create your own custom authentication backend. 1:05 And while it might seem like a minor point, 1:09 DRF is already very good at using proper status codes like 201s or 1:11 failure messages like 429s, that are expected by API clients. 1:15 All in all DRF just saves a lot of time and trouble. 1:19 If you're familiar with Django's class based views, you'll feel right at home 1:24 using DRF's generic views to help reduce boilerplate code. 1:27 If you're not, check the teacher's notes for 1:30 a link to some other content about class based views. 1:32 Is there more? 1:35 Of course. 1:36 You also have access to throttling, filtering, pagination and 1:37 a pretty slick browsable API. 1:40 It's a lot to take in. 1:42 Thankfully the documentation is excellent. 1:44 Community provided plugins will usually cover anything special you might 1:46 need to do with your API too. 1:49 So, along with that very broad overview of what DRS offers, 1:51 what are you going to make in this course? 1:55 Together you and I are going to build a site for viewing educational content. 1:57 There are a couple of sites out there that do this already, but you're going to be 2:01 better than them by being awesome and providing an open accessible API. 2:04 I'll start you off with the Django project that already has models in it for 2:07 courses and reviews. 2:11 Since I like that warm fuzzy feeling I get from sharing, 2:13 I'm going to allow anyone to consume the data. 2:15 Then again, it is the Internet, so I should probably be careful and 2:18 not let just anyone edit that data. 2:20 Which means I'll need to handle authentication and 2:23 only let approved users update the site. 2:25 Just for fun, I'll throw in some other common issues, like throttling, and 2:27 validation, and whatever else comes up. 2:30 Just some little minor details. 2:32 All right, now that you're all briefed, in the next video, 2:35 you will learn how to install and set up Django REST framework. 2:37 And I'll give you a little tour of the project. 2:40
You need to sign up for Treehouse in order to download course files.Sign up