tornado 跑不通,小白求帮忙 - V2EX
V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
lydhr
V2EX    Tornado

tornado 跑不通,小白求帮忙

  •  
  •   lydhr 2015-11-23 14:16:10 +08:00 6046 次点击
    这是一个创建于 3689 天前的主题,其中的信息可能已经有所发展或是发生改变。

    Context :
    - tornado 的 helloWorld 教程代码跑不通, localhost:8000 会报错‘未收到数据’

    - 本机并未装 Nginx ,但是 0.0.0.0 打开后会显示 Welcome to nginx!那个欢迎页

    - terminal 中, nginx command not found

    Question :
    - 如何定位自己的 nginx 转到哪里了?
    - tornado 的 helloWorld 哪里不对?

    第 1 条附言    2015-11-25 15:59:56 +08:00

    自己用 tornado 写的 app.py 现在已经可以在*: 5000 跑起来了
    但是还是奇怪我到底什么时候装了 nginx ?到底装在哪里了?


    mac os x 10.11.1

    当我打开 0.0.0.0 显示 welcome to nginx 页面时,用 chrome 的 network 抓到,:

    Remote Address:127.0.0.1:1080
    Request URL:http://0.0.0.0/
    Request Method:GET
    Status Code:200 OK (from cache)

    lsof -i:1080 得到:
    (我装了 shadowsocks , google 应该是 chrome 吧?(字数有限,删掉了 command 重复的))

    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    mapspushd 498 lynn 5u IPv4 0x383a1360077d5b05 0t0 TCP localhost:64334->localhost:socks (ESTABLISHED)
    IMRemoteU 517 lynn 5u IPv4 0x383a13600f203cc5 0t0 TCP localhost:61101->localhost:socks (CLOSE_WAIT)
    IMRemoteU 517 lynn 12u IPv4 0x383a136006bc1225 0t0 TCP localhost:61100->localhost:socks (CLOSE_WAIT)
    com.apple 531 lynn 11u IPv4 0x383a13600a79f5a5 0t0 TCP localhost:63719->localhost:socks (ESTABLISHED)
    Shadowsoc 922 lynn 47u IPv4 0x383a136006f3d925 0t0 TCP localhost:socks->localhost:63939 (ESTABLISHED)
    Google 3019 lynn 14u IPv4 0x383a136007a58e85 0t0 TCP localhost:63741->localhost:socks (ESTABLISHED)

    13 条回复    2015-12-02 09:45:58 +08:00
    arbipher
        1
    arbipher  
       2015-11-23 14:28:23 +08:00
    本机肯定装 nginx 了。
    0.0.0.0:8000 端口冲突了吗? tornado 换一个端口试试。
    yongzhong
        2
    yongzhong  
       2015-11-23 14:31:20 +08:00
    发个代码吧
    gateswong
        3
    gateswong  
       2015-11-23 14:33:40 +08:00
    我觉得问题问得不对……

    从你的问题看来实际上跟 Tornado 毛线关系都没有,检查一下你的防火墙, nginx 安装位置和配置文件什么的吧
    Eleutherios
        4
    Eleutherios  
       2015-11-23 14:46:11 +08:00 via iPhone
    sudo netstat -ntplu
    zhouzhe8013
        5
    zhouzhe8013  
       2015-11-23 15:21:49 +08:00
    啥机器,linux?mac?wn?
    tornado 不需要 nginx,先确定一下 tornado 有没有启动吧
    然后看看端口占用
    netstat -anpt|grep PID 或者端口
    看看 tornado 在监听那个端口或者你想要的哪个端口被占了
    ldehai
        6
    ldehai  
       2015-11-23 17:02:58 +08:00
    @lydhr 先别管 nginx 的事,首先看你的程序监听的什么端口,比如 8888 。
    如果是的话,直接访问 localhost:8888 就行了
    wingyiu
        7
    wingyiu  
       2015-11-24 00:08:47 +08:00
    python server.py --port=9003
    lsof -i:9003
    lydhr
        8
    lydhr  
    OP
       2015-11-26 16:08:51 +08:00
    @arbipher 如何找到本机的 nginx 装在哪里了?
    - 重启后访问 0.0.0.0 仍是 welcome to nginx 页面
    - 用 chrome 审查元素抓到:
    - Remote Address:127.0.0.1:1080
    - Request URL:http://0.0.0.0/
    - lsof -i:1080
    `
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    IMRemoteU 517 lynn 5u IPv4 0x383a13600f203cc5 0t0 TCP localhost:61101->localhost:socks (CLOSE_WAIT)
    IMRemoteU 517 lynn 12u IPv4 0x383a136006bc1225 0t0 TCP localhost:61100->localhost:socks (CLOSE_WAIT)
    IMRemoteU 517 lynn 13u IPv4 0x383a136006f5f045 0t0 TCP localhost:61106->localhost:socks (CLOSE_WAIT)
    `
    lydhr
        9
    lydhr  
    OP
       2015-11-26 16:10:41 +08:00
    @arbipher 如何找到本机的 nginx 装在哪里了?
    - 重启后访问 0.0.0.0 仍是 welcome to nginx 页面

    - 用 chrome 审查元素抓到:
    - Remote Address:127.0.0.1:1080
    - Request URL:http://0.0.0.0/


    - lsof -i:1080
    `
    COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
    IMRemoteU 517 lynn 5u IPv4 0x383a13600f203cc5 0t0 TCP localhost:61101->localhost:socks (CLOSE_WAIT)
    IMRemoteU 517 lynn 12u IPv4 0x383a136006bc1225 0t0 TCP localhost:61100->localhost:socks (CLOSE_WAIT)
    IMRemoteU 517 lynn 13u IPv4 0x383a136006f5f045 0t0 TCP localhost:61106->localhost:socks (CLOSE_WAIT)
    `
    arbipher
        10
    arbipher  
       2015-11-26 16:20:35 +08:00
    @lydhr
    ps -ef | grep nginx
    lydhr
        11
    lydhr  
    OP
       2015-11-27 13:11:22 +08:00
    @arbipher
    $ ps -ef |grep nginx
    501 1861 458 0 1:11 下午 ttys000 0:00.00 grep nginx
    arbipher
        12
    arbipher  
       2015-11-27 18:40:36 +08:00
    @lydhr 是在下输了。搞不定。。。
    lydhr
        13
    lydhr  
    OP
       2015-12-02 09:45:58 +08:00
    @arbipher anyway,thx a lot~
    关于     帮助文档     自助推广系统     博客     API     FAQ     Solana     5279 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 31ms UTC 09:12 PVG 17:12 LAX 01:12 JFK 04:12
    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