def runserver(host="127.0.0.1", port=8080):
"""Run a gevent-based WSGI server."""
port = int(port)
wrapped_app = app
if app.config.get("DEBUG", True):
#it is necessary to do this for the debug to work, since the classic
# flask debugger does not operate when running the app from
# a WSGIServer() call.
wrapped_app = DebuggedApplication(app)
server = WSGIServer(listener=(host, port), application=wrapped_app,)
def serve():
print(" * Running on http://%s:%d/" % (host, port))
server.serve_forever()
if app.debug:
# the watchdog reloader (with watchdog==0.8.3) appears to hang on
# Windows 8.1, so we're using stat instead
run_with_reloader(
serve, reloader_type="stat" if sys.platform == "win32" else "auto")
else:
serve()
评论列表
文章目录