问题
I'm currently using Werkzeug
together with django-extensions
and I'm able to call the werkzeug
debugger by raising an exception or making a false assertion. Is it possible to just set a breakpoint for werkzeug
like import pdb; pdb.set_trace()
does?
回答1:
If you are using Apache/mod_wsgi, all you need to do is modify your .wsgi file to include:
from werkzeug.debug import DebuggedApplication
and
application = get_wsgi_application()
application = DebuggedApplication(application, evalex=True)
Then you can access the python shell at "example.com/console " (Note the space after console!)
来源:https://stackoverflow.com/questions/15052818/can-i-call-the-werkzeug-debugger-in-django-without-needing-to-raise-an-exception