Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Some things to know about Django Rest Framework
Search
Ordoquy Xavier - Linovia
December 12, 2013
Programming
1
240
Some things to know about Django Rest Framework
Ordoquy Xavier - Linovia
December 12, 2013
Tweet
Share
More Decks by Ordoquy Xavier - Linovia
See All by Ordoquy Xavier - Linovia
SQLAlchemy - un ami qui vous veut du bien
xordoquy
0
6
pycon.fr 2018 - Django REST framework workshop
xordoquy
0
320
mauvaises bonnes idées pour REST
xordoquy
1
380
Authentication and Permissions with Django REST framework
xordoquy
0
190
Buildbot 0.9
xordoquy
0
100
Performances Django REST framework - DjangoCong 2016
xordoquy
0
130
Présentation de l'architecture REST - meetup Django Paris
xordoquy
0
110
Django REST framework workshop @Djangocon Europe 2015
xordoquy
0
120
Django REST framework - DjangoConG 2015
xordoquy
3
140
Other Decks in Programming
See All in Programming
Canon EOS R50 V と R5 Mark II 購入でみえてきた最近のデジイチ VR180 事情、そして VR180 静止画に活路を見出すまで
karad
0
110
Microservices Platforms: When Team Topologies Meets Microservices Patterns
cer
PRO
1
1k
WebRTC と Rust と8K 60fps
tnoho
2
2k
著者と進める!『AIと個人開発したくなったらまずCursorで要件定義だ!』
yasunacoffee
0
130
【CA.ai #3】Google ADKを活用したAI Agent開発と運用知見
harappa80
0
300
20 years of Symfony, what's next?
fabpot
2
350
生成AIを利用するだけでなく、投資できる組織へ
pospome
2
320
配送計画の均等化機能を提供する取り組みについて(⽩⾦鉱業 Meetup Vol.21@六本⽊(数理最適化編))
izu_nori
0
150
Flutter On-device AI로 완성하는 오프라인 앱, 박제창 @DevFest INCHEON 2025
itsmedreamwalker
1
110
DevFest Android in Korea 2025 - 개발자 커뮤니티를 통해 얻는 가치
wisemuji
0
140
バックエンドエンジニアによる Amebaブログ K8s 基盤への CronJobの導入・運用経験
sunabig
0
160
AWS CDKの推しポイントN選
akihisaikeda
1
240
Featured
See All Featured
Large-scale JavaScript Application Architecture
addyosmani
515
110k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.3k
Why Our Code Smells
bkeepers
PRO
340
57k
Typedesign – Prime Four
hannesfritz
42
2.9k
Navigating Team Friction
lara
191
16k
The Invisible Side of Design
smashingmag
302
51k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.2k
Context Engineering - Making Every Token Count
addyosmani
9
510
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.1k
Done Done
chrislema
186
16k
It's Worth the Effort
3n
187
29k
Practical Orchestrator
shlominoach
190
11k
Transcript
Django Rest Framework Tips and Tricks Xavier ORDOQUY @linovia_net
Freelance! (since 2004) Python Django! (Backend) Raven maintainer! (Sentry client)
Former! PyGTK! contributor Various! pull requests irc: Linovia @linovia_net Expertise Dev
Reminder • It is Django ! ! • It is
Python !
Fully featured • Serializers • ModelSerializers • Parsers • Renderers
• Authentication • Permission • Throttling • Routers • Views • ViewSets • Filtering • Testing • Pagination
from rest_framework.decorators import api_view! ! @api_view(['GET'])! def hello_world(request):! return Response({"message":
"Hello, world!"}) but loosely coupled Authentication Content negotiation Serializers Generic views
Customizable web interface
Debug toolbar
pre/post save class MyCreateView(CreateAPIView):! model = models.MyModel! serializer_class = serializers.MySerializer!
! def post_save(self, obj, created):! if created:! obj.reviewers = [user1, user2]!
Class based views class MyMixin(object):! model = models.MyModel! serializer_class =
serializers.MySerializer! ! ! class MyCreateView(MyMixin, CreateAPIView):! pass! • MRO: mixins are on the left side
# views.py! class UserViewSet(viewsets.ModelViewSet):! queryset = User.objects.all()! serializer_class = UserSerializer!
! # urls.py! router = DefaultRouter()! router.register(r'users', views.UserViewSet)! ! urlpatterns = patterns('',! url(r'^', include(router.urls)),! )! Viewsets & routers Nice to get started but optional
Auth / Permissions • Auth are for knowing who you
are ! • Permissions are to grant you access
Testing Utilities • APIRequestFactory + format ! • force_authenticate •
APIClient response = self.client.get('/users/4/')! self.assertEqual(response.data,! {'id': 4, 'username': 'lauren'})!
Performances • Fast to prototype • Easy to tune •
Django performance tips also applies !
Temps em ms 0 10 20 30 40 50 60
70 80 90 100 110 120 130 140 Full stack Serialisation Redis Content nego Middleware HttpResponse Database lookup Redis lookup Serialization Django request/response API view Response rendering
None
• Django Rest Framwork Optimization: http://dabapps.com/blog/api-performance-profiling-django-rest-framework/