我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用app.app.debug()。
def __call__(self, app, host, port, use_debugger, use_reloader): # override the default runserver command to start a Socket.IO server if use_debugger is None: use_debugger = app.debug if use_debugger is None: use_debugger = True if use_reloader is None: use_reloader = app.debug import eventlet # monkey_patch eventlet.monkey_patch() socketio.run(app, host=host, port=port, debug=use_debugger, use_reloader=use_reloader, **self.server_options)
def app(): sc_app.testing = True sc_app.debug = True return sc_app
def internal_error(e): if app.debug: raise e code = hexlify(urandom(4)).decode() error(Exception("Code: {}".format(code), e), exc_info=True) text = '500: Deep Shit\n{}'.format(code) return handle_error(text, InternalServerError.code)
def get_banner(): from app import app color_tmpl = '\x1b[{}m{}\x1b[0m' return color_tmpl.format( *(32, 'Development shell, do whatever you want.') if app.debug else ( 35, 'Production shell, use it carefully!'))
def runserver(): from eventit.eventit import app app.run( host="0.0.0.0", port=8080, debug=True ) # TODO: Create admin user
def get_options(self): options = ( Option('-h', '--host', dest='host', default='0.0.0.0'), Option('-p', '--port', dest='port', type=int, default=18340), Option('-d', '--debug', action='store_true', dest='use_debugger', help=('enable the Werkzeug debugger (DO NOT use in ' 'production code)'), default=self.use_debugger), Option('-D', '--no-debug', action='store_false', dest='use_debugger', help='disable the Werkzeug debugger', default=self.use_debugger), Option('-r', '--reload', action='store_true', dest='use_reloader', help=('monitor Python files for changes (not 100%% safe ' 'for production use)'), default=self.use_reloader), Option('-R', '--no-reload', action='store_false', dest='use_reloader', help='do not monitor Python files for changes', default=self.use_reloader), ) return options
def setUp(self): # Necessary to disable SSLify app.debug = True self.test_app = app.test_client() self.session = app.requests_session
def run(): global application app.debug = True application = DebuggedApplication(application, evalex=True) server = WSGIServer(('localhost', PORT), application, handler_class=WebSocketHandler) server.serve_forever()
def main(argv): from app import app app.debug = "debug" in argv or IS_DEBUG app.run(port=5006)