nginx + uwsgi + flask - disabling custom error pages

后端 未结 3 1610
-上瘾入骨i
-上瘾入骨i 2021-01-11 20:09

Is it possible to disable nginx\'s custom error pages - if I may call them that - to display my framework\'s exception pages?

I can\'t really see my werkzeug debugge

3条回答
  •  再見小時候
    2021-01-11 20:58

    This "Internal Server Error" page is not from nginx but from Flask. It does so when debug mode is off.

    uwsgi is importing your code as a module, not running at as a script. __name__ == '__main__' is False and the if statement is not executed. Try setting debug mode outside of the if:

    app = Flask(__name__)
    app.debug = True
    

    However, it is strongly recommended to never leave the debug mode on a server on the public internet, since the user can make the server run any code. This is a serious security issue.

提交回复
热议问题