Part 1, Chapter 1

App Overview

By the end of this course, you will have built a RESTful API, using Test-Driven Development. The API itself will follow RESTful design principles, using the basic HTTP verbs: GET, POST, PUT, and DELETE.

Endpoint HTTP Method CRUD Method Result
/api/movies GET READ get all movies
/api/movies/:id GET READ get a single movie
/api/movies POST CREATE add a movie
/api/movies/:id PUT UPDATE update a movie
/api/movies/:id DELETE DELETE delete a movie

Along with Python and Django, we'll use Docker to quickly set up our local development environment and simplify deployment and Django REST Framework (DRF) to develop a RESTful API. We'll use pytest instead of unittest for writing unit and integration tests to test the Django API. Finally, we'll store the code on a GitLab repository and utilize the Continuous Integration (CI) features in GitLab to run tests before deploying to Heroku.

Before diving in, let's take a minute to go over why some of the above tools are being used.


Django and Flask are the two most popular Python web frameworks designed for building web applications. While they are both free and open-source, Django is older and more mature and it has a larger community supporting it. It's also more opinionated than Flask, so it requires fewer decisions to be made by you or your team. You can probably move faster that way as long as you don't have any strong disagreements with one or more of the choices that Django makes for you or you have unique application requirements that limit the number of features you can take advantage of.

For more, review Django vs. Flask: Which Framework to Choose.

Django REST Framework

Django REST Framework (DRF) is a widely-used, full-featured API framework designed for building RESTful APIs with Django. At its core, DRF integrates with Django's main features -- models, views, and URLs -- making it simple and seamless to create RESTful HTTP resources.


Docker is a container platform used to streamline application development and deployment workflows across various environments. It's used to package application code, dependencies, and system tools into lightweight containers that can be moved from development machines to production servers quickly and easily.


pytest is a test framework for Python that makes it easy (and fun!) to write, organize, and run tests. When compared to unittest, from the Python standard library, pytest:

  1. Requires less boilerplate code so your test suites will be more readable.
  2. Supports the plain assert statement, which is far more readable and easier to remember compared to the assertSomething methods -- like assertEquals, assertTrue, and assertContains -- in unittest.
  3. Is updated more frequently since it's not part of the Python standard library.
  4. Simplifies setting up and tearing down test state with its fixture system.
  5. Uses a functional approach.


GitLab is a web-based solution for managing the full software development lifecycle. Along with source code management, GitLab provides a number of project management and DevOps-related services, like Kanban boards, package management, logging and monitoring, continuous integration and delivery, secrets management, and container orchestration.

For more, review GitLab Features.


Heroku is a cloud Platform as a Service (PaaS) that provides hosting for web applications. They offer abstracted environments where you don't have to manage the underlying infrastructure, making it easy to manage, deploy, and scale web applications. With just a few clicks you can have your app up and running, ready to receive traffic.

Mark as Completed