Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Django APIs + React (Django Boston - May 2018)
Search
William S. Vincent
May 01, 2018
Technology
0
41
Django APIs + React (Django Boston - May 2018)
Learn about modern web development with Django REST Framework and ReactJS.
William S. Vincent
May 01, 2018
Tweet
Share
More Decks by William S. Vincent
See All by William S. Vincent
Django for AI: Deploying Machine Learning Models with Django
wsvincent
0
11
DjangoCon Europe 2025 Keynote - Django for Data Science
wsvincent
0
970
Django for Data Science (Boston Python Meetup, March 2025)
wsvincent
0
710
DjangoConUS 2024 - Django User Model: Past, Present, and Future
wsvincent
0
60
DjangoCon US 2022 - Solving the Django Jigsaw Puzzle
wsvincent
0
70
DjangoCon US 2019 - Search from the Ground Up
wsvincent
0
440
8 Reasons Why Learning Django is Hard (Django Boston - January 2019)
wsvincent
0
58
DjangoCon US 2018 - Finally Understand User Authentication in Django REST Framework
wsvincent
0
32
Other Decks in Technology
See All in Technology
MariaDB Connector/C のcaching_sha2_passwordプラグインの仕様について
boro1234
0
1k
Next.js 16の新機能 Cache Components について
sutetotanuki
0
180
AIエージェント開発と活用を加速するワークフロー自動生成への挑戦
shibuiwilliam
5
840
オープンソースKeycloakのMCP認可サーバの仕様の対応状況 / 20251219 OpenID BizDay #18 LT Keycloak
oidfj
0
170
20251218_AIを活用した開発生産性向上の全社的な取り組みの進め方について / How to proceed with company-wide initiatives to improve development productivity using AI
yayoi_dd
0
660
AWSの新機能をフル活用した「re:Inventエージェント」開発秘話
minorun365
2
440
MySQLとPostgreSQLのコレーション / Collation of MySQL and PostgreSQL
tmtms
1
1.2k
Oracle Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
1
760
株式会社ビザスク_AI__Engineering_Summit_Tokyo_2025_登壇資料.pdf
eikohashiba
1
110
Amazon Bedrock Knowledge Bases × メタデータ活用で実現する検証可能な RAG 設計
tomoaki25
6
2.3k
Entity Framework Core におけるIN句クエリ最適化について
htkym
0
120
Microsoft Agent Frameworkの可観測性
tomokusaba
1
110
Featured
See All Featured
Creating an realtime collaboration tool: Agile Flush - .NET Oxford
marcduiker
35
2.3k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
710
How to Align SEO within the Product Triangle To Get Buy-In & Support - #RIMC
aleyda
1
1.3k
Being A Developer After 40
akosma
91
590k
Max Prin - Stacking Signals: How International SEO Comes Together (And Falls Apart)
techseoconnect
PRO
0
49
Pawsitive SEO: Lessons from My Dog (and Many Mistakes) on Thriving as a Consultant in the Age of AI
davidcarrasco
0
37
How to build an LLM SEO readiness audit: a practical framework
nmsamuel
1
580
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
70k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
400
[SF Ruby Conf 2025] Rails X
palkan
0
560
Code Review Best Practice
trishagee
74
19k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
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/