Building RESTful Python Web Services with Django
3.9 (5 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
29 students enrolled
Wishlisted Wishlist

Please confirm that you want to add Building RESTful Python Web Services with Django to your Wishlist.

Add to Wishlist

Building RESTful Python Web Services with Django

Create lightweight, maintainable, scalable, and secure web apps using the best tools and techniques
3.9 (5 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
29 students enrolled
Created by Packt Publishing
Last updated 9/2017
Current price: $12 Original price: $125 Discount: 90% off
4 days left at this price!
30-Day Money-Back Guarantee
  • 3 hours on-demand video
  • 1 Supplemental Resource
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion

Training 5 or more people?

Get your team access to Udemy's top 2,000 courses anytime, anywhere.

Try Udemy for Business
What Will I Learn?
  • Develop RESTful APIs from scratch with Python with and without data sources
  • Add authentication and permissions to a RESTful API built in Django framework
  • Map URL patterns to request handlers and check how the API works
View Curriculum
  • You should have some knowledge of RESTful APIs.

Python is the language of choice for millions of developers worldwide, due to its gentle learning curve and its vast applications in day-to-day programming. It builds great and reliable web services in the RESTful architecture. This video will show you the best tools you can use to build your own Python web services.

You’ll start by learning how to develop RESTful APIs using the Django framework combined with related libraries and tools. We’ll delve into the Django framework to build various web services. We’ll show you everything you need to successfully develop RESTful APIs with the Django framework such as request handling, URL mapping, serialization, validation, authentication, authorization, and databases.

By the end of the video, you’ll have a deep understanding of the stacks needed to build RESTful web services.

About the author

Gastón C. Hillar is Italian and has been working with computers since he was eight. He began programming with the legendary Texas TI-99/4A and Commodore 64 home computers in the early 80s. He has a Bachelor's degree in Computer Science (he graduated with honors) and an MBA (he graduated with an outstanding thesis). At present, Gastón is an independent IT consultant and freelance author who is always looking for new adventures around the world.

He has been a senior contributing editor at Dr. Dobb's and has written more than a hundred articles on software development topics. Gastón was also a former Microsoft MVP in technical computing. He has received the prestigious Intel® Black Belt Software Developer award eight times.

Who is the target audience?
  • This video course is for web developers who have a working knowledge of Python and would like to build amazing web services by taking advantage of Python with Django framework.
Compare to Other Python Courses
Curriculum For This Course
37 Lectures
Developing RESTful APIs with Django
6 Lectures 27:40

This video gives an overview of the entire course.

Preview 03:16

In this video, we will work with a very simple SQLite database to make the default database for a new Django REST framework project.

Designing a RESTful API to Interact with a Simple SQLite Database

In this video, we will work with the lightweight virtual environments introduced in Python 3.3 and improved in Python 3.4.

Working with Lightweight Virtual Environments

We will install and set up the Django web framework.

Setting Up the Virtual Environment with Django REST Framework

In this video, we will create a simple game model that we will use to represent and persist games.

Creating the Models

In this video, we will create a serializer class for the game instances to manage serialization and deserialization from JSON.

Managing Serialization and Deserialization
Creating Django Views
3 Lectures 28:26

In this video, we will create Django views to return JSON representations for each HTTP request that our API will handle.

Preview 11:07

In this video, we will compose and send HTTP requests locally in our development computer or devices connected to our LAN.

Making HTTP Requests to the API

In this video, we will work with GUI (Graphical User Interface) tools to easily compose and send HTTP requests.

Working with GUI Tools – Postman and Others
Working with Class-Based Views in Django
5 Lectures 22:35

In this video, we will declare many attributes with the same names that we used in the game model.

Preview 01:56

In this video, we will use a consistent API to provide an accurate response for a game resource or the games collection.

Working with Wrappers to Define API Views

In this video, we will specify the default settings for each view in the gamesapi.

Using the Default Parsing and Rendering Options

In this video, we will use the default content renderers configured in Django REST Framework.

Browsing the API

In this video, we will interact with a complex database model to register player scores into game categories and will understand the HTTP verbs and scope for our new API.

Understanding the Tasks Performed by Each HTTP Method
Working with Hyperlinked APIs in Django
5 Lectures 28:24

We will create the models that we will use to represent and persist the game categories, games, players and scores, and their relationships.

Preview 09:01

RESTful Web API has to be able to serialize and deserialize the GameCategory,Game, Player, and PlayerScore instances into JSON representation.

Managing Serialization and Deserialization with Hyperlinks

We write API views by declaring class-based views, instead of function based views. We use base classes for our class based views to reduce the required code to the minimum and take advantage of the behaviour that has been generalized in Django REST Framework.

Creating Class-Based Views and Using Generic Classes

We create an endpoint for the root of our API to make it easier to browse the API with the browsable API feature and understand how everything works.

Working with Endpoints for the API

We will use the HTTPie command or its curl equivalents to compose and send HTTP requests to the API. You can perform the same tasks with your favorite GUI-based tool or with the browsable API.

Creating and Retrieving Related Resources
Improving Authentication to an API with Django
3 Lectures 15:08

We will make the necessary changes to the Game Category model to add a unique constraint on the name field. We will also add a unique constraint on the name field for the Game and Player models. In this video, we will learn the necessary steps to make changes to the constraints for many models and reflect the changes in the underlying database through migrations.

Preview 03:52

Pagination features available in Django REST Framework make it easy to specify how we want large result sets to be split into individual pages of data.

Taking Advantage of Pagination

We are providing a paginated response that declares a max_limit class attribute that defaults to None. This attribute allows us to indicate the maximum allowable limit that can be specified using the limit query parameter.

Customizing Pagination Classes
Adding Authentication to an API with Django
6 Lectures 22:15

Django REST Framework allows us to easily use different authentication schemes to identify the user that originated the request or the token that signed the request. Then, we use these credentials to apply the permission and throttling policies that will determine whether the request must be permitted or not.

Preview 03:23

The authenticated users will be able to create new games. Only the creator of a game will be able to update or delete it. All the requests that aren't authenticated will only have read-only access to games.

Adding Security-Related Data to the Models

We will use the new permission class to ensure that only the game owners can make changes to an existing game. We will combine the first permission class with the second permission class that only allows read-only access to resources when the request is not authenticated as a user.

Creating a Customized Permission Class for Object-Level Permissions

In this video, we will configure permission policies for the class-based views related to games.

Configuring Permission Policies

In this video, we will compose and send an HTTP request to create a new game with authentication credentials, that is, with the superuser name and their password.

Composing Requests with the Necessary Authentication

In this video, browsable API will compose and send a GET request display the results of its execution, that is, the API Root.

Browsing the API with Authentication Credentials
Additional Features of Django and Django REST Framework
5 Lectures 14:55

So far, we haven't established any limits on the usage of our API and therefore both authenticated and unauthenticated users can compose and send as many requests as they want to. However, any user can compose and send thousands of requests to be processed without any kind of limitation.

Preview 03:28

Now, we can launch Django's development server to compose and send HTTP requests.

Testing Throttling Policies

We took advantage of the pagination features available in Django REST Framework to specify how we wanted large result sets to be split into individual pages of data. However, we have always been working with the entire queryset as the result set. Django REST Framework makes it easy to customize the filtering, searching, and sorting capabilities to the views we have already coded.

Understanding Filtering, Searching, and Ordering Classes

Let’s take a look at how to work with the filter_fields, search_fields, and ordering_fields attributes.

Configuring Filtering, Searching, and Ordering for Views

Now that we know the Configuring filtering, we will explore testing filtering in this video.

Testing Filtering, Searching, and Ordering
Defining and Executing Unit Tests
4 Lectures 12:39

Let’s begin this section by making the necessary configurations to use the django_nose.NoseTestRunnerclass to run all the tests we code. We will use the necessary configurations to improve the accuracy of the test coverage measurements.

Preview 02:31

Now, we will define the first round of unit tests. Specifically, we will define unit tests related to the game category class based views: GameCategoryList and GameCategoryDetail.

Defining a First Round of Unit Tests

We have now defined the first round of unit tests. Let’s run the unit tests in this video.

Running Unit Tests and Checking Testing Coverage

Let’s define additional unit tests to improve the testing coverage. Specifically, we will define unit tests related to the player class based views: PlayerList and PlayerDetail.

Improving Testing Coverage
About the Instructor
Packt Publishing
3.9 Average rating
8,274 Reviews
59,205 Students
687 Courses
Tech Knowledge in Motion

Packt has been committed to developer learning since 2004. A lot has changed in software since then - but Packt has remained responsive to these changes, continuing to look forward at the trends and tools defining the way we work and live. And how to put them to work.

With an extensive library of content - more than 4000 books and video courses -Packt's mission is to help developers stay relevant in a rapidly changing world. From new web frameworks and programming languages, to cutting edge data analytics, and DevOps, Packt takes software professionals in every field to what's important to them now.

From skills that will help you to develop and future proof your career to immediate solutions to every day tech challenges, Packt is a go-to resource to make you a better, smarter developer.

Packt Udemy courses continue this tradition, bringing you comprehensive yet concise video courses straight from the experts.