Workshop - Django REST Framework - Introduction

This is a past event

146 people went


Demystifying Django REST framework - Workshop



This will be an intermediate tutorial on Django Rest Framework. For a
first time user, DRF presents a ton of magic. Things work, but you end
up not knowing or understanding what is happening behind the scenes.
If you would want to tweak something, you wouldn't know where to start
or what to look at.

I've had quite a few frustrating moments trying to figure out what
method mapped to which action, and which ones to override when. The
fact that DRF does not impose the REST architecture confused me to a
good extent as well. Nested relationships was another beast which was
hard to tame.

This tutorial will build an app - not a full fledged front end design
but the endpoints that are required, and will showcase implementing
endpoints using complete abstraction that DRF provides including
Routers, ViewSets and builtin Serializers as the first step.

The second step will break the ViewSets and implement them as normal
class based views, showing what happens behind the scenes. How the
methods are mapped, how it flows through from the moment a request
hits one of the views.

The third step will involve writing the routers by hand, using normal
views and how to fine tune serializers to add your custom fields, etc.

We'll use DRF 3.x for the workshop.

Please make sure you are familiar with Django. If you are new to
Django, you might have a hard time following this workshop.

The rough plan is:

0 - 20 minutes: Brushing up REST architecture and general ice breaker.

20 - 50 minutes: Setting up a Django project and DRF installation.

50 - 1h 20: Implementing the first endpoint, with all abstraction and
goodness of DRF.

1h 20 - 1h 40: Breaking down the ViewSet into simple APIViews and
explaining the methods.

1h 40 - 2h 00: Breaking it further down to manually writing the
routers, normal views, etc.

2h 00 - 2h 30: Implementation of a nested relationship.

2h 30 - 3h 00: General discussion, pitfalls and do's as well as dont's.

Installation instructions:

I am using the following:

- virtualenv ( )

Unless you know well about managing your system wide installation and
versions (and even if you do), please have virtualenv installed and

- Python 3.5
- Django==1.10.1
- djangorestframework==3.4.6

If you want to use Python 2.7, that's totally fine. Just make sure
Django works properly for your setup and have djangorestframework

- We will use sqlite as the database, which usually comes bundled
along with Python. But just double check to make sure that you have it
installed. (Hint: Simply starting a Django project and running `python migrate` should work flawlessly and leave you with a
db.sqlite3 file in your root folder).

- Please have a Linux / Unix distribution installed
on your machines or at least have a VM running it. You can use Windows
if you are comfortable with its working / shell / etc. I won't be able
to help you much with anything platform related if you are using

- Please familiarize yourself to use the command line tool called
"curl". We will be using that to test our endpoints. Alternatives are
the Postman App on Mac, the Postman Chrome extension or even the
Python httpie library. You will not
be able to follow along the workshop if you are not familiar using at
least one of these.

Content: .


1. RSVP opens 7 days before the event.

2. The event is free of cost.

3. Waitlisted participants will receive confirmation notification about a day before the event.

4. If you aren't sure or have other important work to do, please UNRSVP and help others attend.

Follow us on Twitter ( and FaceBook ( Join our discussion in Slack ( and Mailing List ( Read about past meetup in the blog (