Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Architecture en Webservice avec Django
Search
Ordoquy Xavier - Linovia
October 26, 2013
Technology
210
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Architecture en Webservice avec Django
Ordoquy Xavier - Linovia
October 26, 2013
Transcript
23 slides
Architecture en Webservices avec Django Xavier Ordoquy Linovia
Freelance! (since 2004) Dev Python Dev Django! (Backend) Mainteneur Raven
(Sentry) Ancien contributeur ! PyGTK Contributions! diverses irc: Linovia @linovia_net
Problèmes d’une architecture classique • Base de code complexe à
maintenir • Evolutions des librairies couteuses en ressources • Isolation • Dimensionnement
Accès à une ressource Web app Indicateurs Export ERP CRM
Sources de données tierces Multi-sites Database
webservice ? • Fournisseur: http://localhost:8000/ • Point d’entrée: /api/v1/users/ •
Contrat d’interface: {‘username’: ‘johndoe’, …}
Architecture Webservice données couche métier présentation AAA
Nouvelle API données couche métier présentation AAA V1 V2
Avantages • Garantie du contrat d’interface • Stabilité dans le
temps • Migration souple • Moins de maintenance • Plus de nouvelles fonctionnalités
OK, et Django ?
Django Rest Framework • Modulaire… • mais pas minimaliste •
Découplé (pas besoin de models) • Idiomes Django (CBV, forms, noms des options…)
Features • Generic views • Serializers • Permissions • Renderers
/ Parsers • Routers • Content negotiation • Filters • Pagination • Throttling • Tests
from rest_framework.decorators import api_view! ! @api_view(['GET'])! def hello_world(request):! return Response({"message":
"Hello, world!"})
class UserSerializer(serializers.ModelSerializer):! class Meta:! model = User! fields = ('email',
'username', ‘last_login')! ! class UserViewSet(viewsets.ModelViewSet):! queryset = User.objects.all()! serializer_class = UserSerializer! permission_classes = (permissions.IsAuthenticatedOrReadOnly)! ! router = DefaultRouter()! router.register(r'user', UserViewSet)
Et les performances avec Django ?
Qui pense que Django EST rapide ?
Qui pense que Django EST rapide lent ?
None
None
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
Django-roa • Resource Oriented Architecture • Coté client • Simplifie
la séparation • Integration avec rest framework (bientôt avec les serializers)
Exemple class Tweet(roa.Model):! text = models.TextField()! source = models.CharField(max_length=50)! user
= models.ForeignKey(User)! ! @staticmethod! def get_resource_url_list():! return u'http://twitter.com/statuses/public_timeline.json'
None
Merci • http://django-rest-framework.org • http://code.larlet.fr/django-roa/wiki/Home • http://bit.ly/1d8hOyV • http://bit.ly/1adlAs9
More Decks by Ordoquy Xavier - Linovia
See All by Ordoquy Xavier - Linovia
Comprendre les interruptions de service lors des mises en production.
xordoquy
0
20
SQLAlchemy - un ami qui vous veut du bien
xordoquy
0
31
pycon.fr 2018 - Django REST framework workshop
xordoquy
0
360
mauvaises bonnes idées pour REST
xordoquy
1
420
Authentication and Permissions with Django REST framework
xordoquy
0
210
Buildbot 0.9
xordoquy
0
110
Performances Django REST framework - DjangoCong 2016
xordoquy
0
140
Présentation de l'architecture REST - meetup Django Paris
xordoquy
0
120
Django REST framework workshop @Djangocon Europe 2015
xordoquy
0
130
Other Decks in Technology
See All in Technology
これからのデータエンジニアの役割について考える / Rethinking the Role of Data Engineers in the AI Era
okiyuki99
0
490
Agent Harnessはどう作る?事例から学ぶAI Agentの設計思想
sergicalsix
0
300
内製アプリとClaudeスキルのセキュリティチェック、 Backlogの課題で回しています。
ayaka_egaaa
0
190
Intro to Kiro (One agent, every surface) | Kiro: Zero to Hero 01
inariku
PRO
2
130
_マネジメントする人される人ナイト_2026__良いチームを作っていきたい_お気持ち_.pdf
xkxaxkx
0
410
長い仕事を任せる (Workflows、クラウドセッション、Kiro Web) | 目指せ Kiro マスター 10
inariku
PRO
3
190
BALLAS Technology Deck
ballas_inc
0
620
セキュリティ専任チームなしで攻撃を先回りするSREが実践したSIEM on Amazon OpenSearch Service
cscengineer
PRO
1
880
変更差分を読むために環境を整備しよう
pipepasta
1
260
Kiro CLI 入門 (ターミナルと CI で使う) | 目指せ Kiro マスター 03
inariku
PRO
2
150
Biohub - Cell Tracking During Development 5th place solution
rist
0
160
Frontier Teams — Amazon は AI で「開発のやり方」をどう変えたのか
kmotohas
0
250
Featured
See All Featured
Hiding What from Whom? A Critical Review of the History of Programming languages for Music
tomoyanonymous
3
1.4k
WCS-LA-2024
lcolladotor
0
1k
Building a Scalable Design System with Sketch
lauravandoore
464
34k
Git: the NoSQL Database
bkeepers
PRO
433
67k
The #1 spot is gone: here's how to win anyway
tamaranovitovic
4
1.2k
The agentic SEO stack - context over prompts
schlessera
0
1k
Bridging the Design Gap: How Collaborative Modelling removes blockers to flow between stakeholders and teams @FastFlow conf
baasie
0
770
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
4
4.4k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
470
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
Bash Introduction
62gerente
615
220k
Everyday Curiosity
cassininazir
0
400