TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Advanced Flask Patterns

115 点作者 kracekumar将近 13 年前

8 条评论

j4mie将近 13 年前
I love Flask for simple stuff, but I'm a little concerned that, as someone who considers himself a relatively advanced Python developer, I don't really understand quite a lot of this.<p>I have no doubt that if I dug into it then it would all make sense, but my first instinct is this: how much of this complexity (proxy objects to thread locals, context stacks etc) results from the fact that doing:<p><pre><code> from flask import request </code></pre> is just a bad idea?<p>Perhaps things would be easier if instead of:<p><pre><code> from flask import request ... @app.route('/'): def index(): return "Hello from %s" % request.args.get('name') </code></pre> we did:<p><pre><code> @app.route('/'): def index(request): return "Hello from %s" % request.args.get('name') </code></pre> I'm probably massively over-simplifying things, but the idea of magically importing state is the one aspect of Flask that always felt a bit odd to me.
评论 #4207440 未加载
评论 #4207355 未加载
评论 #4207433 未加载
Smerity将近 13 年前
If you're interested in this talk, Armin provides the slides and links to video for many of his previous presentations at his website[1]. The talks range from horrific (but useful) Python hackery to an overview of Python web app development.<p>[1]: <a href="http://lucumr.pocoo.org/talks/" rel="nofollow">http://lucumr.pocoo.org/talks/</a>
评论 #4209782 未加载
Grepsy将近 13 年前
This presentation, but with notes by Armin:<p><a href="http://dev.pocoo.org/~mitsuhiko/FlaskPatterns_notes.pdf" rel="nofollow">http://dev.pocoo.org/~mitsuhiko/FlaskPatterns_notes.pdf</a>
obeattie将近 13 年前
The video is also on YouTube <a href="http://www.youtube.com/watch?v=KOvgfbBFZxk&#38;feature=youtube_gdata_player" rel="nofollow">http://www.youtube.com/watch?v=KOvgfbBFZxk&#38;feature=youtu...</a><p>Would definitely recommend… I was at the talk yesterday, very clever stuff.
评论 #4209217 未加载
ericingram将近 13 年前
As someone who hasn't used Flask before, this makes me not want to try. I'm not even sure what problem is being solved in this presentation.<p>Anyone care to explain what these advanced patterns are useful for?
评论 #4207756 未加载
评论 #4208053 未加载
评论 #4207947 未加载
maybe_someday将近 13 年前
The video for this would be nice, it's a bit hard understanding some of the slides without context.
earnubs将近 13 年前
Very disappointed this wasn't a gallery of Thermos tartans.
yashchandra将近 13 年前
Always happy to see Flask related stuff on HN front page :). Being a novice python wannabe, I am still struggling with thread locals but more than happy to keep working with Flask. Reading the source code is fun.