有用过 Flask 的吗?曾经遇过什么坑? - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
cmkpl
V2EX    Python

有用过 Flask 的吗?曾经遇过什么坑?

  •  
  •   cmkpl
    cmkpl 2015 年 1 月 20 日 5385 次点击
    这是一个创建于 4079 天前的主题,其中的信息可能已经有所发展或是发生改变。

    想用Flask 开小网站,不知道大家遇过什么坑没有?

    25 条回复    2016-07-29 23:45:00 +08:00
    O21
        1
    O21  
       2015 年 1 月 20 日 via iPhone
    有坑也是自己挖的
    iloahz
        2
    iloahz  
       2015 年 1 月 20 日 via iPhone
    blueprint不如django的好用,个人觉得
    yrdr
        3
    yrdr  
       2015 年 1 月 20 日
    Flask上手还是蛮简单的,可能是刚入python,暂时不清楚坑在哪里
    washinriver
        4
    washinriver  
       2015 年 1 月 20 日
    项目一直在用,坑还好
    kavi
        5
    kavi  
       2015 年 1 月 20 日
    最近也是刚上手,关注一下。
    tonyleen
        6
    tonyleen  
       2015 年 1 月 20 日
    之前用过,很简单的项目,到没遇到什么坑.
    snopy
        7
    snopy  
       2015 年 1 月 20 日
    目前在用Flask+sqlalchemy做开发...
    skywalker
        8
    skywalker  
       2015 年 1 月 20 日
    挺好的,记得哪个Django的核心开发人员说过,Django出现的太早了,Flask才是Django应该的样子。
    idblife
        9
    idblife  
       2015 年 1 月 20 日
    @skywalker
    请标注出处
    sujin190
        10
    sujin190  
       2015 年 1 月 20 日
    日志,有点乱
    icedx
        11
    icedx  
       2015 年 1 月 20 日 via Android
    依赖数据库太强 不能在Loop 内使用Loop 外的逻辑?
    happywowwow
        12
    happywowwow  
       2015 年 1 月 20 日
    http://stackoverflow.com/questions/28017782/flask-app-turn-off-without-any-information
    昨天遇到的一个问题 不清楚是为什么了
    后来 uninstall install 了flask-sqlalchemy

    最后发现好像是view里使用sqlalchemy不正确,有外键只add了而没commit,但好像不是这个原因

    问题修改了几次
    yakczh
        13
    yakczh  
       2015 年 1 月 20 日
    用sqlalchemy查出来的数据,不能直接输出json
    crazyxin1988
        14
    crazyxin1988  
       2015 年 1 月 20 日   1
    @yakczh
    可以在model里加个to_json方法转一下~
    cloverstd
        15
    cloverstd  
       2015 年 1 月 20 日
    难道就我一个人用 peewee 么
    yakczh
        16
    yakczh  
       2015 年 1 月 20 日
    @crazyxin1988 不同请求查询需要的字段都不一样
    crazyxin1988
        17
    crazyxin1988  
       2015 年 1 月 20 日
    @yakczh
    蛋都碎一地
    整个model所有字段全部转一下,前端想用啥就用啥
    yakczh
        18
    yakczh  
       2015 年 1 月 20 日
    要加字段
    cicku
        19
    cicku  
       2015 年 1 月 20 日
    flask 自己写过博客和网站,小应用挺好玩的,而且扩展性强所以我觉得没什么大坑。
    vob636
        20
    vob636  
       2015 年 1 月 20 日
    我觉得不应该只有我一个人用Marshmallow搭配SQLAlchemy输出结果的吧?
    skywalker
        21
    skywalker  
       2015 年 1 月 20 日   1
    @idblife 本来是自己随便看过的,不过去搜了下还是找到了,当然你要我严格的引用我是没这本事,

    仅供参考:

    https://news.ycombinator.com/item?id=7105799

    This last past year, at DjangoCon US Chicago, I had the pleasure of sitting at the same table as Jacob Kaplan-Moss for the Speakers dinner prior to the conference. Very cool experience. My first.

    I brought up Flask and asked him what he thought of it. I had recently used it for a project for the first time and likely only did so because I was SUPPOSE TO BE FOCUSING on Django and preparing a talk about it. So naturally, I procrasinated and did everything but. It's been on my radar for awhile. I was attracted to it by it's documentation. Turns out, I really enjoyed it. It felt familiar because I've used Django for so long. I brought this up at the dinner table.

    Jacob said something that took me by surprise. I can't quote him exactly--the wine and drinks were too good that evening, but it was something to the effect of "Flask is what Django should have been". Another fellow from our table chimed in and added "If only Django had existed before we created Django!" What he ment was, without Django, Flask wouldn't of had such a clear and smooth start. Django taught us a lot.

    What I took from this was, both have their place and we have a lot to be thankful for, especially coming from the Django community. In regards to longevity, I think community is a major factor but these two technolgoies are both under Python, and I think the Python community at-large is what matters here. Hearing what Jacob had to say on Flask was sobering. There is no end-all-be-all, and both of these technolgoies have more in common than not.
    billlee
        22
    billlee  
       2015 年 1 月 20 日
    blueprint 注册到 '/' 的时候,静态资源注册不到 "/static" 上
    x3byg9oyv27Wlx
        23
    x3byg9oyv27Wlx  
       2015 年 1 月 20 日
    确实木有什么坑啊,用的很爽
    ityao
        24
    ityao  
       2015 年 1 月 20 日
    从flask转去sails的无比爽
    lmeetr
        25
    lmeetr  
       2016 年 7 月 29 日
    坑太多了。最大的坑就是没有事务管理,非常的麻烦。
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     2955 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 22ms UTC 13:37 PVG 21:37 LAX 06:37 JFK 09:37
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86