fix examples for freeze_support() issue on windows (#2741)

Co-authored-by: Adam Hopkins <adam@amhopkins.com>
This commit is contained in:
Mohammad Almoghrabi 2023-07-05 13:45:08 +03:00 committed by GitHub
parent 273825dab6
commit f2cc83c1ba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 42 additions and 37 deletions

View File

@ -25,5 +25,5 @@ def key_exist_handler(request):
return text("num does not exist in request") return text("num does not exist in request")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, debug=True) app.run(host="0.0.0.0", port=8000, debug=True)

View File

@ -50,4 +50,5 @@ def pop_handler(request):
app.blueprint(bp, url_prefix="/bp") app.blueprint(bp, url_prefix="/bp")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, debug=True, auto_reload=False) app.run(host="0.0.0.0", port=8000, debug=True, auto_reload=False)

View File

@ -37,4 +37,5 @@ app.blueprint(blueprint)
app.blueprint(blueprint2) app.blueprint(blueprint2)
app.blueprint(blueprint3) app.blueprint(blueprint3)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=9999, debug=True) app.run(host="0.0.0.0", port=9999, debug=True)

View File

@ -69,5 +69,5 @@ async def runner(app: Sanic, app_server: AsyncioServer):
app.is_running = False app.is_running = False
app.is_stopping = True app.is_stopping = True
if __name__ == "__main__":
https.run(port=HTTPS_PORT, debug=True) https.run(port=HTTPS_PORT, debug=True)

View File

@ -39,4 +39,5 @@ async def test(request):
return json(response) return json(response)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000, workers=2) app.run(host="0.0.0.0", port=8000, workers=2)

View File

@ -20,4 +20,5 @@ def test(request):
return text("hey") return text("hey")
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000) app.run(host="0.0.0.0", port=8000)

View File

@ -20,4 +20,5 @@ def timeout(request, exception):
return response.text("RequestTimeout from error_handler.", 408) return response.text("RequestTimeout from error_handler.", 408)
if __name__ == "__main__":
app.run(host="0.0.0.0", port=8000) app.run(host="0.0.0.0", port=8000)

View File

@ -35,7 +35,7 @@ async def after_server_stop(app, loop):
async def test(request): async def test(request):
return response.json({"answer": "42"}) return response.json({"answer": "42"})
if __name__ == "__main__":
asyncio.set_event_loop(uvloop.new_event_loop()) asyncio.set_event_loop(uvloop.new_event_loop())
serv_coro = app.create_server( serv_coro = app.create_server(
host="0.0.0.0", port=8000, return_asyncio_server=True host="0.0.0.0", port=8000, return_asyncio_server=True