V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
o618
V2EX  ›  问与答

tornado 如何定义某个名字

  •  
  •   o618 · Feb 12, 2014 · 2722 views
    This topic created in 4456 days ago, the information mentioned may be changed or developed.
    定义了self.get_argument('reply_id'),但程序运行报错:Missing argument reply_id
    2 replies    1970-01-01 08:00:00 +08:00
    PotatoBrother
        1
    PotatoBrother  
       Feb 12, 2014   ❤️ 1
    1.确认handlers里有写url
    2.访问时访问正确的url
    mywaiting
        2
    mywaiting  
       Feb 12, 2014   ❤️ 1
    Tornado的web.py代码写得很清楚啊。默认情况下,没有提供默认参数给get_argument(),而且你的URL中没有包含这个参数的话,Tornado会报Missing argument

    用get_argument()的时候,最好传递默认值,像这样:

    reply_id = self.get_argument('reply_id', None)

    这样Tornado就不会报Missing argument
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1252 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 43ms · UTC 23:57 · PVG 07:57 · LAX 16:57 · JFK 19:57
    ♥ Do have faith in what you're doing.