非常奇怪的问题,只能用 chrome 访问 python2 flask, curl 或 wget 访问超时 - 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
July7

非常奇怪的问题,只能用 chrome 访问 python2 flask, curl 或 wget 访问超时

  •  
  •   July7 Jun 29, 2018 3622 views
    This topic created in 2879 days ago, the information mentioned may be changed or developed.
    阿里云的 Windows server 机器,装了 python2,运行 flask,用本地浏览器 Chrome 能访问一个地址如 http://localhost:8080/echo,顺利得到返回。
    用 curl 或者 wget 同样地址就卡在那里一直拿不到返回,直到超时。


    wget http://localhost:8080/echo
    --2018-06-28 10:58:31-- http://localhost:8080/echo
    Resolving localhost (localhost)... ::1, 127.0.0.1
    Connecting to localhost (localhost)|::1|:8080... failed: Connection refused.
    Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
    HTTP reqest sent, awaiting response...

    我是用 mingw 和 cygwin 实验都如此。用 java 程序 get 这个地址,仍然超时。
    5 replies    2018-06-30 20:52:47 +08:00
    ca1123
        1
    ca1123  
       Jun 29, 2018
    IE 可以访问么?
    nicevar
        2
    nicevar  
       Jun 29, 2018
    这种问题抓个包看一下过程就知道了,靠猜解决不了问题
    lalalakakaka
        3
    lalalakakaka  
       Jun 29, 2018
    你是不是用了 python 自带的 webserver 模块?那个模块并发性能就是个残疾,会自己把自己卡死。
    建议换成 gevent 试试
    houzhiqiang
        4
    houzhiqiang  
       Jun 29, 2018
    部署的时候使用 gunicorn + gevent (或者看看 gunicorn 的各种工作模式),开发可以开启 flask 的多线程或者多进程,
    app.run(host='127.0.0.1', port='5000', debug=True, threaded=True)
    wushaojun321
        5
    wushaojun321  
       Jun 30, 2018 via iPhone
    单线程跑只能有一个客户访问吧
    About     Help     Advertise     Blog     API     FAQ     Solana     3060 Online   Highest 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 36ms UTC 02:50 PVG 10:50 LAX 19:50 JFK 22:50
    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