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
Pythonの高速軽量フレームワーク
Search
shimakaze-git
January 12, 2019
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Pythonの高速軽量フレームワーク
shimakaze-git
January 12, 2019
More Decks by shimakaze-git
See All by shimakaze-git
DjangoとFastAPIによる 実践認証技術
shimakaze_soft
0
940
フロントエンドとバックエンドのコミュニケーションをスムーズにするスキーマ駆動開発
shimakaze_soft
2
560
クリーンアーキテクチャのリポジトリパターン - Pythonでの実装
shimakaze_soft
1
6.1k
lt20221030.pdf
shimakaze_soft
0
180
Dependabotを使って 運用しているおはなし
shimakaze_soft
0
2.3k
DjangoCongressJP 2019/2020 & 今年にPyConJP初登壇できたはなし
shimakaze_soft
0
460
GAEによるPythonWEBアプリケーションの高速開発
shimakaze_soft
0
3.2k
FlaskとDjango以外のAPI開発の選択肢
shimakaze_soft
0
520
Python で Dependency Injection(DI) をやるには?
shimakaze_soft
1
3.8k
Featured
See All Featured
Leveraging LLMs for student feedback in introductory data science courses - posit::conf(2025)
minecr
1
280
The AI Revolution Will Not Be Monopolized: How open-source beats economies of scale, even for LLMs
inesmontani
PRO
3
3.5k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
234
17k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
1
250
Stewardship and Sustainability of Urban and Community Forests
pwiseman
0
220
The Language of Interfaces
destraynor
162
27k
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
530
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
360
Practical Orchestrator
shlominoach
191
11k
Digital Ethics as a Driver of Design Innovation
axbom
PRO
1
310
For a Future-Friendly Web
brad_frost
183
10k
SEOcharity - Dark patterns in SEO and UX: How to avoid them and build a more ethical web
sarafernandez
0
200
Transcript
Pythonの高速軽量フレームワーク
- Python, PHP, Node - Backend, Infrastructure - Twitter(@shimakaze_soft) -
GitHub(shimakaze-git) - Note(shimakaze_soft) @shimakaze_soft
こんな人にオススメの内容 Q.PythonのWEBアプリケーション開発事情について少し知りたい Q.FlaskとDjango以外の開発知見について少し知りたい A. Flaskについて軽く触れます
こんな人にオススメの内容 Q. お前にマサカリを投げてやりたい A. お手柔らかにお願いいたします
Python界の二台巨頭WEBフレームワーク - Flask フラスク(読み) - 軽量フレームワーク - ASGI - 学習コスト(低)
- Django ジャンゴ(読み) - フルスタックフレームワーク - ASGI - 学習コスト(中 〜 高)
- Django - Flask - Pyramid - Bottle - Tornade
- Responder - Sanic いろんなWEBフレームワークあるけどあんまり普及していない
Djangoの使い道 - 本格的なWEBアプリケーショの開 発 - フロントとバックエンドも一括でや りたい際 - (余談) InstagramとCompassは
Django製
Flaskの使い道 - ちょっとした検証用のプロダクトを 作る際 - 機械学習エンジン(分類器)などを 作る際 - PythonでWEBをやる際の入門?
APIを開発する場合の選択肢は?(Django) フロントとバックエンドを完全分離する場合 Djangoを使用する - DjangoでAPI開発のためのDjango RestFramework(DRF)というのがあるけど、 学習コストがかなり高い - Django自体そこまでパフォーマンスが速いわけではないので、API用途でわざわざ 使う意味がある?
APIを開発する場合の選択肢は?(Flask) フロントとバックエンドを完全分離する場合 Flaskを使用した場合 - パフォーマンスが遅い - 設計でディレクトリ分けをちゃんとやらないとカオスになる - フレームワーク単体の機能が少ないので、サードパーティーをうまく組み合わせる 必要がある
- Flaskは開発者のmitsuhiko氏がRustに開発の軸足を移し始めて、衰退傾向?
Flaskの簡単なコード from flask import Flask, jsonify, make_response, request app =
Flask() @app.route("/hello") def hello_to(): foo = request.args.get("foo", "") body = jsonify({ "Hello": “Hello”, }) resp = make_response(body, 200) return resp @app.route("/hello/<test>") def hello_to(test): foo = request.args.get("foo", "") body = jsonify({ "Hello": test, }) resp = make_response(body, 200) return resp 開発していくとコードが肥 大化して読みづらくなって くる
API用途に最適なフレームワーク(Falcon) - パフォーマンスはFlaskの20倍 - Hook, Middlewareという機能が標準で備 えられている - Cythonでビルドすると更に高速化されるよ うに設計されている
- RESTのアーキテクチャスタイルを取り入 れいている サンプルコード類 https://github.com/shimakaze-git/falcon-todo
falcon 3.0が2019年以内に出るよ Falcon3.0が4~6月にリリースされる予定 - 非同期処理を標準でサポート - 初期時にCythonでビルドされたモジュールが使える