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
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
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
230
ITAC | Websec 1
racterub
0
260
ITAC | Linux Basics
racterub
0
130
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
手塩にかけりゃいいってもんじゃない
ming_ayami
0
470
NAB Show 2026 動画技術関連レポート / NAB Show 2026 Report
cyberagentdevelopers
PRO
0
170
Oracle AI Database@Google Cloud:サービス概要のご紹介
oracle4engineer
PRO
6
1.5k
LLMと共に進化するプロセスを目指して
ymatsuwitter
13
4.1k
タクシーアプリ『GO』の実践的データ活用
mot_techtalk
3
190
AI駆動開発を通して感じた、 AI時代のデザイナーの役割変化
whisaiyo
1
1.2k
Claude Codeをどのように キャッチアップしているか
oikon48
12
6.5k
中期計画、2回作ってみた ~業務委託と正社員、両方の視点から~
demaecan
1
690
作って終わりにしない タイミーのセマンティックレイヤー育成の現在地
chanyou0311
4
2.2k
Bucharest Tech Week 2026 - Reinventing testing practices in the AI era
edeandrea
PRO
1
150
On-behalf-of Token exchange with AgentCore Identity
hironobuiga
2
150
2026TECHFRESH畢業分享會 - AI 時代的人生存檔點
line_developers_tw
PRO
0
870
Featured
See All Featured
The Director’s Chair: Orchestrating AI for Truly Effective Learning
tmiket
1
190
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
133
19k
Scaling GitHub
holman
464
140k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
27k
Statistics for Hackers
jakevdp
799
230k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
31
2.8k
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
6k
What does AI have to do with Human Rights?
axbom
PRO
1
2.2k
Six Lessons from altMBA
skipperchong
29
4.3k
Agile that works and the tools we love
rasmusluckow
331
21k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
10
1.2k
Cheating the UX When There Is Nothing More to Optimize - PixelPioneers
stephaniewalter
287
14k
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