def init_app(self, app): for k, v in iteritems(self._default_config(app)): app.config.setdefault(k, v) if not app.config['DEBUG_TB_ENABLED']: return if not app.config.get('SECRET_KEY'): raise RuntimeError( "The Flask-DebugToolbar requires the 'SECRET_KEY' config " "var to be set") DebugToolbar.load_panels(app) app.before_request(self.process_request) app.after_request(self.process_response) app.teardown_request(self.teardown_request) # Monkey-patch the Flask.dispatch_request method app.dispatch_request = self.dispatch_request app.add_url_rule('/_debug_toolbar/static/<path:filename>', '_debug_toolbar.static', self.send_static_file) app.register_blueprint(module, url_prefix='/_debug_toolbar/views')