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
Pythonの高速軽量フレームワーク
Search
shimakaze-git
January 12, 2019
270
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
1.3k
フロントエンドとバックエンドのコミュニケーションをスムーズにするスキーマ駆動開発
shimakaze_soft
2
610
クリーンアーキテクチャのリポジトリパターン - Pythonでの実装
shimakaze_soft
1
6.5k
lt20221030.pdf
shimakaze_soft
0
200
Dependabotを使って 運用しているおはなし
shimakaze_soft
0
2.3k
DjangoCongressJP 2019/2020 & 今年にPyConJP初登壇できたはなし
shimakaze_soft
0
490
GAEによるPythonWEBアプリケーションの高速開発
shimakaze_soft
0
3.3k
FlaskとDjango以外のAPI開発の選択肢
shimakaze_soft
0
550
Python で Dependency Injection(DI) をやるには?
shimakaze_soft
1
4k
Featured
See All Featured
Facilitating Awesome Meetings
lara
57
7.2k
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Why Your Marketing Sucks and What You Can Do About It - Sophie Logan
marketingsoph
0
460
Designing Dashboards & Data Visualisations in Web Apps
destraynor
232
55k
What's in a price? How to price your products and services
michaelherold
247
13k
Organizational Design Perspectives: An Ontology of Organizational Design Elements
kimpetersen
PRO
1
880
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
50
10k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.8k
Raft: Consensus for Rubyists
vanstee
143
7.9k
Designing Powerful Visuals for Engaging Learning
tmiket
1
650
Learning to Love Humans: Emotional Interface Design
aarron
275
41k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
47
8.4k
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でビルドされたモジュールが使える