W3Cschool
恭喜您成為首批注冊用戶
獲得88經(jīng)驗(yàn)值獎勵(lì)
Depending on the WSGI gateway/server, exceptions are handled differently.But most of the time, exceptions go to stderr or the error log.
Since this is not the best debugging environment, Werkzeug provides aWSGI middleware that renders nice debugging tracebacks, optionally with anAJAX based debugger (which allows to execute code in the context of thetraceback's frames).
The interactive debugger however does not work in forking environmentswhich makes it nearly impossible to use on production servers. Also thedebugger allows the execution of arbitrary code which makes it a majorsecurity risk and must never be used on production machines because ofthat.
You can enable the debugger by wrapping the application in aDebuggedApplication middleware. Additionally there areparameters to the run_simple() function to enable it because thisis a common task during development.
class werkzeug.debug.DebuggedApplication(app, evalex=False, request_key='werkzeug.request', console_path='/console', console_init_func=None, show_hidden_frames=False, lodgeit_url=None)
Enables debugging support for a given application:
from werkzeug.debug import DebuggedApplication
from myapp import app
app = DebuggedApplication(app, evalex=True)
The evalex keyword argument allows evaluating expressions in atraceback's frame context.
0.9 新版功能: The lodgeit_url parameter was deprecated.
參數(shù): |
|
---|
Once enabled and an error happens during a request you will see a detailedtraceback instead of a general “internal server error”. If you have theevalex feature enabled you can also get a traceback for every frame inthe traceback by clicking on the console icon.
Once clicked a console opens where you can execute Python code in:
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網(wǎng)安備35020302033924號
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: