o618
V2EX  ›  问与答

tornado 如何定义某个名字

  •  
  •   o618 · Feb 12, 2014 · 2862 views
    This topic created in 4540 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   ·   2988 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 30576480 · 37ms · UTC 00:34 · PVG 08:34 · LAX 17:34 · JFK 20:34
    ♥ Do have faith in what you're doing.