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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Building websites in Python with Flask

276 点作者 dabent超过 12 年前

21 条评论

3amOpsGuy超过 12 年前
Great tutorial, a good level of detail too.<p>The only other thing i'd mention for Flask newbies would be the excellent debugger facility in Werkzeug (effectively a part of Flask).<p>I lied, one more reference - the guy that wrote flask (bit of a genius, also has a bunch of other <i>excellent</i> libraries) has shared slides from some talks he's given, they're really worth a read too: <a href="http://lucumr.pocoo.org/talks/" rel="nofollow">http://lucumr.pocoo.org/talks/</a><p>Bucket list 2013, attend a talk by Armin Ronacher.
评论 #4643564 未加载
评论 #4643860 未加载
whalesalad超过 12 年前
I wish more people would contribute information on using Flask at a larger scale. Everyone and their brother has written a basic tutorial outlining how to get up and running with Flask. This is a GREAT post and I do not want to demean it ... however I think that a lot of this can be gleaned from following along with the docs and experimenting with Flask in general.<p>I'd really love to see/hear some stories of others using Flask at a slightly larger scale. For example ... did your startup build their REST API in Flask? Sure, people say it's possible and outline a basic hello-world style REST app ... but in my experience it became a pain in the ass very quick. Primarily because no structure is enforced.<p>After being a Python dev for a long time, building quite a few big Django apps and a handful of tiny Flask apps I have finally jumped ship to Rails. I spent a week experimenting with various Pythonic combinations. Ultimately I had to ask myself ... "Why am I doing this? What the hell am I wasting my time with this lightweight framework?" I've built my current REST API in Rails and would not have it any other way. It's been tremendously efficient and performs great on my little Linode in London + PostgreSQL.
评论 #4645404 未加载
评论 #4648270 未加载
评论 #4649261 未加载
评论 #4646128 未加载
评论 #4647401 未加载
joeshaw超过 12 年前
A good tutorial, but it was missing any mention of blueprints, which are essential to building a Flask site larger than a few endpoints. Blueprints also allow you to reuse components across multiple apps, or as releasing a set of endpoints as open source libraries that can be easily plugged into other apps.<p>Edit: adding a link to Blueprints in the Flask docs: <a href="http://flask.pocoo.org/docs/blueprints/" rel="nofollow">http://flask.pocoo.org/docs/blueprints/</a>
评论 #4644038 未加载
RegEx超过 12 年前
Good read. I wrote a similar Flask introductory article[0] on how I moved my Wordpress site/blog over to Flask. The source code of my site can be viewed on github[1].<p>[0]: <a href="http://vertstudios.com/blog/new-flask-site/" rel="nofollow">http://vertstudios.com/blog/new-flask-site/</a> [1]: <a href="https://github.com/joequery/Vert-Flask" rel="nofollow">https://github.com/joequery/Vert-Flask</a>
mumphster超过 12 年前
Great little tutorial but I'd also like to mention that if you're creating websites using flask make sure to check out blueprints (<a href="http://flask.pocoo.org/docs/blueprints/" rel="nofollow">http://flask.pocoo.org/docs/blueprints/</a>) it lets you modualize your website and make it a lot more manageable once your code gets a little bit larger.
评论 #4644245 未加载
welder超过 12 年前
Great tutorial.<p>Since you're already using backbone.js why not plug in CSRF protection with Flask-SeaSurf? (<a href="http://flask.pocoo.org/extensions/" rel="nofollow">http://flask.pocoo.org/extensions/</a>)<p>If you use this backbone.js change then CSRF is practically invisible: <a href="https://github.com/alanhamlett/backbone/commit/91941afe693ae85bc5303b8e61982876cd5ae415" rel="nofollow">https://github.com/alanhamlett/backbone/commit/91941afe693ae...</a><p>Also, if building an api with Flask make sure you use blueprints with a url prefix so your api routes become relative, which means less typing: <a href="http://flask.pocoo.org/docs/blueprints/" rel="nofollow">http://flask.pocoo.org/docs/blueprints/</a>
jpadilla_超过 12 年前
Flask is so damn awesome! For all those other projects Django seems too big, I use Flask. The hardest thing for me was finding a project structure that worked for me. I still haven't landed one that was "perfect". What project structure/skeletons for Flask apps work for you?
评论 #4643670 未加载
评论 #4644042 未加载
corford超过 12 年前
Flask is awesome and I'd strongly recommend it to anyone curious about doing webdev in python.<p>When I was starting out, I found the source code to the Flask website itself really helpful for getting to grips with the basics: <a href="https://github.com/mitsuhiko/flask/tree/website/flask_website" rel="nofollow">https://github.com/mitsuhiko/flask/tree/website/flask_websit...</a>
评论 #4644430 未加载
lazydon超过 12 年前
I just cannot thank you enough - you are a life saver. Coming from Java world I was looking for exactly like this. Maybe I'm new to Python, I was just about to give up. Setting Nginx/Apache for Flask was giving me nightmares -just could not get it right to play with gunicorn, uwsgi and so on.<p>I know Java is verbose but the tooling is good. Just put you war(a pre-defined structure) in Tomcat webapps dir and your good to go with a fairly scalable web site. I was so surprised it wasn’t that easy for Python. I think it stems out that Python is more of systemish kinda ecosystem.
评论 #4644523 未加载
minikomi超过 12 年前
Good stuff! Just a question, in the first session example, should the url_for('say_hello') be url_for('message')? And in the message template, 'index' maybe should be 'home'.
评论 #4644048 未加载
jrvarela56超过 12 年前
I've always wondered why people who like using these python micro frameworks don't use App Engine. Have any of you guys tried out GAE and decided it wasn't worth it?
评论 #4643560 未加载
评论 #4643348 未加载
评论 #4643403 未加载
评论 #4643244 未加载
评论 #4643220 未加载
评论 #4643633 未加载
评论 #4643431 未加载
d_luaz超过 12 年前
For those working on GAE, try this handy template: <a href="https://github.com/kamalgill/flask-appengine-template" rel="nofollow">https://github.com/kamalgill/flask-appengine-template</a>
codegeek超过 12 年前
good read. I am working on something built in scratch using Flask and so far, it has been a breeze in understanding the document, source code and samples provided on the pocoo site.
cake超过 12 年前
See also bottle <a href="http://bottlepy.org/docs/dev/" rel="nofollow">http://bottlepy.org/docs/dev/</a><p>Both are great but I find them very slow.
评论 #4645056 未加载
评论 #4644259 未加载
评论 #4645014 未加载
bcambel超过 12 年前
what an amazing tutorial!
countessa超过 12 年前
Nicely done. I'm a Ruby/Sintra bod myself, but now I'm keen to play with Flask a bit - thanks!
nyddle超过 12 年前
Thanks for the tutorial. Can't wait for the next part about blueprints!
liamchzh超过 12 年前
what's the difference between Flask and Django?
评论 #4644606 未加载
评论 #4644153 未加载
d0m超过 12 年前
Good tutorial. You should check out Django. It comes with most of the script you have written plus a lot more and a really active community.
评论 #4643652 未加载
paulsutter超过 12 年前
Any opinions about Flask vs Bottle?
评论 #4644696 未加载
chuppo超过 12 年前
So you took flask documentation, some other sources and made it into a blog post about it?
评论 #4644306 未加载