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
Sponsored
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
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
150
ITAC | Websec 3
racterub
0
250
ITAC | Websec 2
racterub
0
240
ITAC | Websec 1
racterub
0
260
ITAC | Linux Basics
racterub
0
140
Introducing Reverse Engineering @ YZU CS250
racterub
0
240
ITAC | Jinja & Bootstrap
racterub
1
130
ITAC-Flask | Environment setup
racterub
1
110
Other Decks in Technology
See All in Technology
どうして今サーバーサイドKotlinを選択したのか
nealle
0
190
事業価値を⽣み出すSREへ SREが担うべき意思決定の5層
kenta_hi
0
150
Tech-Verse 2026_Keynote
lycorptech_jp
PRO
0
130
「ちゃんとやっている」は独りよがりだった ― 不安に寄り添うインシデント対応へ / Towards incident response that addresses anxieties
chmikata
1
380
ご挨拶「10周年を迎える共創ラボのこれまでとこれから」
iotcomjpadmin
0
180
AI Agentをシステムに組み込む前にゆるく向き合ってみる
hayama17
0
200
AWS Summit Japan 2026の振り返りと2027へ向けて / AWS Summit Japan 2026 Recap and Prospects for 2027
kaminashi
1
190
Why is RC4 still being used?
tamaiyutaro
0
290
RAGの精度向上とエージェント活用
kintotechdev
2
130
AWS Summit 2026で見えたSIerにとっての Amazon Quickの位置づけ
maf_0521
0
160
記録をかんたんに、提案をパーソナルに ── AIであすけんが目指すもの
oprstchn
0
140
Claude Code 珍プレー好プレー
shinyasaita
0
190
Featured
See All Featured
Marketing to machines
jonoalderson
1
5.5k
Odyssey Design
rkendrick25
PRO
2
720
Claude Code どこまでも/ Claude Code Everywhere
nwiizo
65
56k
Art, The Web, and Tiny UX
lynnandtonic
304
22k
Reality Check: Gamification 10 Years Later
codingconduct
0
2.2k
The Impact of AI in SEO - AI Overviews June 2024 Edition
aleyda
5
1.1k
The Pragmatic Product Professional
lauravandoore
37
7.4k
Typedesign – Prime Four
hannesfritz
42
3.1k
Stop Working from a Prison Cell
hatefulcrawdad
274
21k
Agile that works and the tools we love
rasmusluckow
331
22k
The Organizational Zoo: Understanding Human Behavior Agility Through Metaphoric Constructive Conversations (based on the works of Arthur Shelley, Ph.D)
kimpetersen
PRO
0
380
Product Roadmaps are Hard
iamctodd
55
12k
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