Flask view raises TypeError: 'bool' object is not callable

后端 未结 1 1542
孤城傲影
孤城傲影 2020-11-21 11:20

I am trying to debug a view in my Flask app that is return a 500 status with the error TypeError: \'bool\' object is not callable in the traceback. The view cal

1条回答
  •  南笙
    南笙 (楼主)
    2020-11-21 12:02

    In Flask, a view must return one of the following:

    • a string
    • a Response object (or subclass)
    • a tuple of (string, status, headers) or (string, status)
    • a valid WSGI application

    Flask tests for the first 3 options, and if they don't fit, assumes it is the fourth. You returned True somewhere, and it is being treated as a WSGI application instead.

    See About Responses in the documentation.

    0 讨论(0)
提交回复
热议问题