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
ITAC | Flask - Basic Flask
Search
racterub
May 19, 2020
Technology
110
1
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
ITAC | Flask - Basic Flask
ITAC | Flask - Basic Flask
racterub
May 19, 2020
More Decks by racterub
See All by racterub
IM620 Web Security
racterub
0
170
ITAC | Websec 3
racterub
0
260
ITAC | Websec 2
racterub
0
250
ITAC | Websec 1
racterub
0
280
ITAC | Linux Basics
racterub
0
140
Introducing Reverse Engineering @ YZU CS250
racterub
0
240
ITAC | Jinja & Bootstrap
racterub
1
140
ITAC-Flask | Environment setup
racterub
1
120
Other Decks in Technology
See All in Technology
AIエージェントの開発・提供におけるセキュリティリスクの論点と対策
flatt_security
2
600
IoTハンズオンの舞台裏
shirouz
2
160
PM領域でのAI Agentの活用
lycorptech_jp
PRO
0
280
Azure Cost Management の FOCUS コストデータを迷わず読むための“3つの軸”
tetsuyaooooo
0
150
AI活用の現在地、 ちゃんと見えてますか?/XPfest-2026
visional_engineering_and_design
0
160
なぜSRE・セキュリティは評価されないのか?守りの組織を事業成長エンジンに変えた実践
cscengineer
PRO
3
2.3k
Webとヘルスデータ
yukukotani
1
200
AIに丸投げしないトイル削減 / Eliminating Toil Without Leaving It All to AI
kohbis
3
990
Beyond the Hype: Practical AI for Your Oracle Database with MCP
thatjeffsmith
1
280
AI時代に、プロダクトの数だけ積み上がる所有コストをどうエンジニアリングするか / Engineering the Cost of Ownership
kzkmaeda
1
1.1k
設計の世代交代を乗り越える、14年続くAndroidアプリの開発戦略
sansantech
PRO
1
150
Driving AI Adoption Using In-House GPUs to Serve Qwen
po3rin
2
460
Featured
See All Featured
Designing for humans not robots
tammielis
254
26k
Statistics for Hackers
jakevdp
799
230k
Facilitating Awesome Meetings
lara
57
7.1k
HTML-Aware ERB: The Path to Reactive Rendering @ RubyCon 2026, Rimini, Italy
marcoroth
4
590
The browser strikes back
jonoalderson
0
1.6k
Future Trends and Review - Lecture 12 - Web Technologies (1019888BNR)
signer
PRO
0
3.7k
Build The Right Thing And Hit Your Dates
maggiecrowley
39
3.4k
The untapped power of vector embeddings
frankvandijk
2
1.9k
Designing for Timeless Needs
cassininazir
1
470
Building Experiences: Design Systems, User Experience, and Full Site Editing
marktimemedia
0
600
Tell your own story through comics
letsgokoyo
1
1.1k
State of Search Keynote: SEO is Dead Long Live SEO
ryanjones
0
260
Transcript
Flask Racterub@ITAC 1
Whoami? • 電通英專⼤⼀ • 好像沒什麼好講的了 2
簡報在這 https://reurl.cc/z8Kqqy 3
Flask • Flask是⼀個使⽤Python編寫的輕量級Web應⽤框架。 • Flask沒有預設使⽤的資料庫、表單驗證⼯具,但是可以⽤ Flask-extension加入這些功能:ORM、表單驗證⼯具、檔 案上傳、各種開放式⾝分驗證技術。 4
GitHub • https://git.io/Jfe1c • 範例 Code 在這邊ㄛ,之後⼤部分會以實作為主 • 如果你裝不起來的 •
http://racterub.me:8000 • 拜託不要把他玩壞 5
起⼿式 from flask import Flask app = Flask(__name__) @app.route("/") def
hello(): return "Hello World!" if __name__ == "__main__": app.run() 6
In-url param @app.route("/db/<dbname>/<int:dbid>") def db(dbname, dbid): return "dbname: %s, dbid:
%s" % (dbname, dbid+123) 7
GET param @app.route("/get/") def get(): name = request.args.get("name") passwd =
request.args.get("passwd") return "name: %s, password: %s" % (name, passwd) 8
POST param @app.route("/post/") def post(): name = request.form["name"] passwd =
request.form["passwd"] return "name: %s, password: %s" % (name, passwd) 9
Login @app.route("/login/", methods=["POST", "GET"]) def login(): if request.method == "POST":
try: if (request.form["username"] == "test" and request.form["password"] == "test"): session["user"] = request.form["username"] return "Success" else: return redirect(url_for("login")) except ValueError: return "Something broke", 400 else: return render_template("login.html") 10
Serve static file @app.route("/robots.txt") def robot(): return send_from_directory("static", "robots.txt") 11
make_response @app.route("/makeresponse/") def makeresp(): resp = make_response("test", 200) resp.headers['X-Author'] =
"ITAC" return resp 12
render_template @app.route("/jinja/<name>") def jinja(name): return render_template("index.html", title=name) 13
Q/A 14