Developing RESTful APIs with Django REST Framework

  • Updated July 12th, 2022
  • v1.0.0
Špela Giacomelli (aka GirlLovesToCode) Špela Giacomelli (aka GirlLovesToCode)

In this course, we'll emulate the real-life development cycle of an app. You'll get to know Django REST Framework from the ground up as you work your way from basics to more advanced topics:

  • Views, Routers, and Serializers
  • Manual testing with Postman
  • Automated testing with pytest
  • Authenticated, authorization, and throttling
  • Filters, pagination, customization, and Browsable API
  • Documenting and versioning
  • Docker, Heroku, and Deployment

Along the way you'll also learn about some advanced Django topics, and towards the end you'll dive into Test-driven Development.

What will you learn?

Select a Part

In the first part, you'll learn the basics of Django REST Framework, like serializers, views, and routers. You'll also look at how to manually test your API as well as use pytest to write automated tests. At the end of the first part, you'll see how to consume your API from a web client.

Learning Objectives

  1. Configure Django REST Framework views, serializers, and routers
  2. Add custom actions to a ViewSet
  3. Create custom serializers
  4. Use Postman to manually test your API
  5. Write automated tests with pytest
  6. Consume an API from a web client

In part 2, you'll work on improving your API. We'll add ordering, validation, pagination, and a search endpoint. We'll also add access control to the API and provide documentation. We'll switch from a write-code-first approach to Test-driven Development. At the end of this part, you'll use Docker to deploy your API to Heroku.

Learning Objectives

  1. Use out-of-the-box and custom permissions
  2. Practice Test-driven Development
  3. Configure and customize pagination
  4. Set up authentication, ordering, and filtering
  5. Generate documentation with drf-spectacular
  6. Dockerize a Django application
  7. Deploy a Dockerized Django application to Heroku

What do you need to know?

This course is targeted at advanced-beginners -- someone with at least 6 months of web development experience. Before beginning, you should have some familiarity with the following topics:

Meet the Author

Špela Giacomelli (aka GirlLovesToCode)

Špela Giacomelli (aka GirlLovesToCode)

GirlThatLovesToCode is passionate about learning new things -- both for herself and for teaching others. She's a fan of Python and Django and wants to know everything there is about those two. When she’s not writing code or a blog, she’s probably trying something new, reading, or spending time outside with her family.

What developers are saying

The TestDriven.io courses are some of the best courses I've ever done for any language, any platform, any price range... just some of the most thorough and well-sourced courses around.

Just a word of thanks for doing such a great job with these training courses. The thorough, entire-lifecycle approach -- from implementation through test, coverage, quality, CI/CD, and all the rest -- is what separates these courses from other training material that I've completed. I'll be able to walk away from here with knowledge and skills that I can apply immediately at work -- and for that I'm grateful. It's a rare gift in an environment where so much 'training' is really just lightweight treatment that doesn't begin to scratch the surface of real, end-to-end software development. Really well done!

The TestDriven.io courses are worth 10 times what I paid for them.

I'm writing to thank you for all the tutorials and the work you've put out there. I'm new to DevOps and I found TestDriven.io while looking for Django and DevOps related topics. One of the best collections of tutorials and guides I've seen -- very well-written, clear, and concise. You have saved me so much time and energy. Thanks from the bottom of my heart.

I am very much into buying and purchasing any course by you and your team. I've never felt like a better programmer ready to show my coding chops to the world.

Frequently Asked Questions

What tools and technologies are used in this course?

This course covers a variety of technologies and services:

Core

  1. Python
  2. Django
  3. Django REST framework
  4. Docker
  5. Postgres
  6. WhiteNoise
  7. drf-spectacular
  8. dj-database-url
  9. Gunicorn

Testing and Monitoring

  1. pytest
  2. pytest-cov
  3. Flake8
  4. Black
  5. isort

Services

  1. GitHub
  2. Postman
  3. Heroku

What can I learn to build with Django REST framework?

Django REST framework is a toolkit built on top of Django that allows you to create RESTful APIs that can be consumed by a number of clients, like a web app, web page, phone app, or a web server, to name a few.

Django REST framework, due to its flexibility, allows you to quickly build public or private, simple or complex APIs. It includes authentication and serialization out-of-the-box as well.

Since this course covers (almost) everything from a simple API that takes advantage of pre-built features to more advanced topics and customization, you'll be able to use that knowledge to build an API suited to your needs and still take advantage of the batteries that comes with Django (e.g., its awesome admin interface).

Django REST framework is the right choice to turn to if you need to quickly build powerful RESTful APIs.

What support does TestDriven.io offer?

Since the courses mimic real-world development, support is provided via Stack Overflow. Helpful users, including the developers of the courses, read and respond to messages on Stack Overflow. If you get stuck and you can't find an answer via Stack Overflow, feel free to reach out via email directly. Just be sure to detail what you've tried. For more, review Support and Consulting.

How long does it take to complete the course?

It's dependent on your current skill level. On average, it takes approximately 12 hours to complete.