TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Advanced Flask Patterns

115 pointsby kracekumaralmost 13 years ago

8 comments

j4miealmost 13 years ago
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 未加载
Smerityalmost 13 years ago
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 未加载
Grepsyalmost 13 years ago
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>
obeattiealmost 13 years ago
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 未加载
ericingramalmost 13 years ago
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_somedayalmost 13 years ago
The video for this would be nice, it's a bit hard understanding some of the slides without context.
earnubsalmost 13 years ago
Very disappointed this wasn't a gallery of Thermos tartans.
yashchandraalmost 13 years ago
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.