Flask app raises a 500 error with no exception

前端 未结 2 660
野趣味
野趣味 2020-12-15 16:38

I\'ve been banging my head against this method in Flask for some time, and while it seems I\'m making progress now, I\'ve just happened upon something that baffles me to no

相关标签:
2条回答
  • I had the same issue, but the underlying cause was different than the one in Slater's response:

    I was muting the logger that the stack trace goes to. Be sure that you are not filtering out the flask.app logger, which is where the exception stack traces go to (note that this is different than the flask server's informational logs, named app.api).

    0 讨论(0)
  • 2020-12-15 17:12

    After beating my head against this some more I finally figured it out thanks to the awesome people on the pocoo google group (I have since learned that there is a separate list for flask). Firstly, I needed to turn on the PROPAGATE_EXCEPTIONS option in my app configuration (http://flask.pocoo.org/docs/config/#builtin-configuration-values).

    After that was done I realized there was an issue with not returning a response from a view function, which Flask interpreted this method as. Since that was the case, this issue was resolved by just adding:

    return jsonify(result={"status": 200})
    

    To the end of the try block. I hope this helps someone in a similar situation in the future.

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