Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Django APIs + React (Django Boston - May 2018)
Search
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
William S. Vincent
May 01, 2018
Technology
72
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Django APIs + React (Django Boston - May 2018)
Learn about modern web development with Django REST Framework and ReactJS.
William S. Vincent
May 01, 2018
More Decks by William S. Vincent
See All by William S. Vincent
Django for AI: Deploying Machine Learning Models with Django
wsvincent
0
24
DjangoCon Europe 2025 Keynote - Django for Data Science
wsvincent
0
1.4k
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
860
DjangoConUS 2024 - Django User Model: Past, Present, and Future
wsvincent
0
110
DjangoCon US 2022 - Solving the Django Jigsaw Puzzle
wsvincent
0
110
DjangoCon US 2019 - Search from the Ground Up
wsvincent
0
480
8 Reasons Why Learning Django is Hard (Django Boston - January 2019)
wsvincent
0
100
DjangoCon US 2018 - Finally Understand User Authentication in Django REST Framework
wsvincent
0
55
Other Decks in Technology
See All in Technology
2026TECHFRESH畢業分享會 - 原生還是跨平台? App 開發踩坑實錄
line_developers_tw
PRO
0
960
自宅LLMの話
jacopen
1
520
Oracle AI Database@Azure:サービス概要のご紹介
oracle4engineer
PRO
6
2k
白金鉱業Meetup_Vol.24_「AIエージェントは分けるほど良い」は本当か? / Is it true that “the more you divide AI agents, the better”?
brainpadpr
1
360
社内 AI エージェント Synapse と セマンティックレイヤーの育て方
hiroakis
3
1.8k
Chainlitで作るお手軽チャットUI
ynt0485
0
230
非定型業務をAI slackbotで自動化する ~ 社内要望を自動壁打ちするbotを作った ~/automating-ad-hoc-work-with-ai-slackbot
shibayu36
0
640
小さくはじめるSLI/SLO ~育てながら組織に定着させる実践知~ / Starting Small with SLI/SLOs: Building Adoption Through Continuous Growth
nari_ex
7
1.9k
2026TECHFRESH畢業分享會 - Lightning Talk - 資料也要 CI/CD? 用 Airbyte 自動化資料同步
line_developers_tw
PRO
0
940
現地で盛り上がった WWDC26 Keynote
zozotech
PRO
1
230
失敗を経て、Harness Engineering で 大切にしたいことを考える / Learning from Failure: What Matters in Harness Engineering
bitkey
PRO
1
350
日本 Fintech 未来予測レポート 2027〜2028年(オリジナル版)
8maki
0
2.1k
Featured
See All Featured
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
2k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
160
Imperfection Machines: The Place of Print at Facebook
scottboms
270
14k
ラッコキーワード サービス紹介資料
rakko
1
3.6M
How to Talk to Developers About Accessibility
jct
2
230
Evolving SEO for Evolving Search Engines
ryanjones
0
220
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
YesSQL, Process and Tooling at Scale
rocio
174
15k
Accessibility Awareness
sabderemane
1
140
The Illustrated Guide to Node.js - THAT Conference 2024
reverentgeek
1
380
So, you think you're a good person
axbom
PRO
2
2.1k
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
230
Transcript
William S. Vincent Django APIs + React Django Boston (May
2018) Modern web development with Django Rest Framework & ReactJS
William S. Vincent Who Am I? • Freelance software developer
• Early employee at Quizlet, other startups • Books
William S. Vincent API • Application Programming Interface (API) •
Way for 2 computers to communicate • Need agreed-upon rules (a protocol)
William S. Vincent Why APIs? Pros • Future proof •
Multiple frontends (iOS, Android, web) • Internal or external access Cons • More set up required • User auth is tricky (sessions, tokens, JWT) • JS frameworks change
William S. Vincent What is a web API?
William S. Vincent HTTP • HTTP: Communications protocol for the
web • Web APIs sit “on top” of HTTP • API endpoints: url + available HTTP verbs
William S. Vincent HTTP Verbs Functionality Create Read Update Delete
HTTP Method/Verb POST GET PUT DELETE Rough equivalence between CRUD & HTTP verbs
William S. Vincent HTTP Status Codes Code 2xx 3xx 4xx
5xx Meaning Success (200, 201) Redirection (301) Client error (404) Server error (500)
William S. Vincent API Endpoints • https://mysite.com/api/users # GET returns
collection of all users • https://mysite.com/api/users/<id> # GET returns a single user
William S. Vincent Django APIs
William S. Vincent Building APIs with Django • Multiple packages
available • Django Rest Framework the clear favorite ◦ Easily add to existing Django sites ◦ Complete feature set ◦ Very mature
William S. Vincent Django vs Django API Structure Django template.html
urls.py views.py models.py Django API serializers.py
William S. Vincent Django Rest Framework
William S. Vincent Django + DRF • Add DRF to
existing(!) Django sites • Only need models.py file from regular Django • Write DRF-specific urls.py, views.py, and serializers.py files
William S. Vincent Django Blog 1. Create a new Django
project/app 2. Update models.py and admin.py 3. Add blog posts via Django admin https://github.com/wsvincent/djangoboston-drf-react-blog
William S. Vincent Adding DRF • Install, update settings.py •
Update urls.py (project/app level) • Update views.py
William S. Vincent Serializers • The real “magic” of Django
Rest Framework • Transform models/querysets into JSON • Deserializers transform data from client back into complex data types too
William S. Vincent Serializers # posts/serializers.py from rest_framework import serializers
from . import models class PostSerializer(serializers.ModelSerializer): class Meta: fields = ('id', 'title', 'body',) model = models.Post
William S. Vincent Browsable API
William S. Vincent CORS (Cross-Origin Resource Sharing) • Fundamental security
feature of the web • Allows for cross-domain requests • HTTP Headers added
William S. Vincent What We Didnʼt Cover • Viewsets/Routers •
Authentication/Permissions • Documentation • Tests, Throttling, Pagination, etc.
William S. Vincent Adding React Or Vue, Angular, etc...
William S. Vincent React setup
William S. Vincent Project structure frontend ├── public ├── src
├── App.js backend ├── backend_project ├── settings.py ├── urls.py ├── posts ├── models.py ├── serializers.py ├── views.py ├── urls.py
William S. Vincent App.js • Only need to update one
file! • Endpoint: http://127.0.0.1:8000/api/v1/ • Use map() to display all blog posts
William S. Vincent Conclusion • Add DRF to an existing
Django project • Add CORS headers! • Use create-react-app • Run frontend/backend in two consoles
William S. Vincent Resources Django Rest Framework Docs http://www.django-rest-framework.org/ Demo
Project https://github.com/wsvincent/djangoboston-drf-react-blog Slides https://tinyurl.com/drf-react My Site https://wsvincent.com/