pecan.middleware.debug – Pecan Debugging Middleware

class pecan.middleware.debug.DebugMiddleware(app, debugger=<function post_mortem at 0x2ac2bcde8488>)

Bases: object

A WSGI middleware that provides debugging assistance for development environments.

To enable the debugging middleware, simply set the debug flag to True in your configuration file:

app = {
    ...
    'debug': True,
    ...
}

Once enabled, the middleware will automatically catch exceptions raised by your application, and display the Python stack trace and WSGI environment in your browser for easy debugging.

To further aid in debugging, the middleware includes the ability to repeat the offending request, automatically inserting a breakpoint, and dropping your console into the Python debugger, pdb.

For more information, refer to the documentation for pdb available on the Python website.

Parameters:
  • app – the application to wrap.
  • debugger – a callable to start debugging, defaulting to the Python debugger, pdb.

Previous topic

pecan.hooks – Pecan Hooks

Next topic

pecan.jsonify – Pecan JSON Support

This Page