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
Building a GraphQL API with DJango
Search
James Muranga
August 13, 2017
Programming
130
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Building a GraphQL API with DJango
Slides from the Tutorial at DjangoCon 2017
James Muranga
August 13, 2017
Other Decks in Programming
See All in Programming
バグを直したら useEffect が消えた
colorful12
3
660
Detecting Compromised CI with eBPF and Cilium Tetragon
lizrice
0
220
Android CLI
fornewid
0
230
AIを紡ぐPMのお話
swdtkuy
0
120
20260722_microCMSで考える、AI時代のコンテンツ運用設計
yosh1
0
440
Cloudflare is Agents
chimame
0
170
Webエンジニアなのにブラウザの仕組みがわからないので、Pythonで自作してみた
tatsuki12
4
800
今さら聞けない .NET CLI
htkym
0
200
まだ間に合う!今年の夏こそSchemeのマクロ展開器を完全理解!
omasanori
0
150
運用ダッシュボードの設計を誰も教えてくれないのだけどみなさんどうしてるんですか? - チームに監視するという文化を根付かせるための第一歩を踏みたい -
satoshi256kbyte
1
140
KotlinConf Extended South Korea 2026 Keynote
l2hyunwoo
0
110
Go を使い始めて 2 ヶ月の学び / My first two months with Go
contour_gara
0
310
Featured
See All Featured
Redefining SEO in the New Era of Traffic Generation
szymonslowik
1
390
Agile Actions for Facilitating Distributed Teams - ADO2019
mkilby
0
260
Jamie Indigo - Trashchat’s Guide to Black Boxes: Technical SEO Tactics for LLMs
techseoconnect
PRO
0
630
Unlocking the hidden potential of vector embeddings in international SEO
frankvandijk
0
900
Reality Check: Gamification 10 Years Later
codingconduct
0
2.3k
Joys of Absence: A Defence of Solitary Play
codingconduct
1
440
Design in an AI World
tapps
1
280
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
210
SERP Conf. Vienna - Web Accessibility: Optimizing for Inclusivity and SEO
sarafernandez
2
1.6k
The browser strikes back
jonoalderson
0
1.5k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
3
1.1k
Building Flexible Design Systems
yeseniaperezcruz
330
40k
Transcript
Building A GraphQL API Using Django James Muranga
Developer at ThoughtWorks @murangajames
[email protected]
PLEASE SHARE ANY FEEDBACK YOU
HAVE FOR ME
Building A GraphQL API Using Django
AGENDA •What is GraphQL •Why? •Graphene ? •Django App
SETUP •Python •An Editor (VSCode, Atom, PyCharm etc) •Starter project
http://bit.ly/2fCLUGp FEEL FREE TO INTERRUPT AND ASK QUESTIONS
GraphQL A Query Language for APIs
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Defines shape of Data Hierarchical Strongly typed Protocol Introspective
Why GraphQL ?
•REST •SOAP •JSON RPC •… What else is there ?
RESTFUL API FOR “SOME APP” •List of Users •Each User
has notes •Each Notes has revisions
GET https://api.someapp.com/api/v1/users [ { "id": "2016", "name": "The one who
cant be named", "notes": [ { "id": "2015", "content": "The friend", "revision": "1", "size": 108, "topics": [ "octocat", "atom", "electron", "API" ], "has_issues": true, "has_wiki": true, "has_pages": false, "has_downloads": true, "pushed_at": "2011-01-26T19:06:43Z", "created_at": "2011-01-26T19:01:12Z", "updated_at": "2011-01-26T19:14:43Z", "permissions": { "admin": false, "push": false, "pull": true }, "subscribers_count": 42, "network_count": 0 } ] }
REQUESTS ARE HUGE !!!
GET https://api.someapp.com/api/v2/users [ { "id": "2016", "name": "The one who
cant be named", "notes": "https://api.app.com/api/users/2016/notes" } ] GET https://api.someapp.com/api/v2/users/2016/notes [ { "id": "2015", "content": "The friend", "revision": "1", "size": 108, "topics": [ "octocat",
REQUESTS ARE MANY !!!
Request Response
Graphene an example implementation in Python
SCHEMA QUERY MUTATION
None
None
None
SCHEMA QUERY MUTATION
SCHEMA QUERY MUTATION
None
GRAPHENE DEMO http://bit.ly/2fCLUGp
Polls App • Setup • Walkthrough the App • Add
Schema • Browse GraphiQL • Write Tests • Add mutation • Write more tests • Handle Users • Questions
SETUP •Python •An Editor (VSCode, Atom, PyCharm etc) •Starter project
http://bit.ly/2fCLUGp FEEL FREE TO INTERRUPT AND ASK QUESTIONS
Debug GRAPHENE = { 'SCHEMA': 'polls.schema.schema', 'MIDDLEWARE': [ 'graphene_django.debug.DjangoDebugMiddleware', ]
} debug = graphene.Field(DjangoDebug,name='__debug')
Schema ./manage.py graphql_schema —schema out.json
Users
http://graphene-python.org/ http://graphql.org/
GraphQL is just another tool