Merge pull request #1553 from jrmi/master
Fix #1551 add missing parameter in create_server
This commit is contained in:
commit
5631a31099
|
@ -92,7 +92,7 @@ to run the app in general.
|
||||||
Here is an incomplete example (please see `run_async.py` in examples for something more practical):
|
Here is an incomplete example (please see `run_async.py` in examples for something more practical):
|
||||||
|
|
||||||
```python
|
```python
|
||||||
server = app.create_server(host="0.0.0.0", port=8000)
|
server = app.create_server(host="0.0.0.0", port=8000, return_asyncio_server=True)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
task = asyncio.ensure_future(server)
|
task = asyncio.ensure_future(server)
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
|
|
|
@ -76,7 +76,7 @@ async def test(request):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
asyncio.set_event_loop(uvloop.new_event_loop())
|
asyncio.set_event_loop(uvloop.new_event_loop())
|
||||||
server = app.create_server(host="0.0.0.0", port=8000)
|
server = app.create_server(host="0.0.0.0", port=8000, return_asyncio_server=True)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
loop.set_task_factory(context.task_factory)
|
loop.set_task_factory(context.task_factory)
|
||||||
task = asyncio.ensure_future(server)
|
task = asyncio.ensure_future(server)
|
||||||
|
|
|
@ -12,7 +12,7 @@ async def test(request):
|
||||||
return response.json({"answer": "42"})
|
return response.json({"answer": "42"})
|
||||||
|
|
||||||
asyncio.set_event_loop(uvloop.new_event_loop())
|
asyncio.set_event_loop(uvloop.new_event_loop())
|
||||||
server = app.create_server(host="0.0.0.0", port=8000)
|
server = app.create_server(host="0.0.0.0", port=8000, return_asyncio_server=True)
|
||||||
loop = asyncio.get_event_loop()
|
loop = asyncio.get_event_loop()
|
||||||
task = asyncio.ensure_future(server)
|
task = asyncio.ensure_future(server)
|
||||||
signal(SIGINT, lambda s, f: loop.stop())
|
signal(SIGINT, lambda s, f: loop.stop())
|
||||||
|
|
Loading…
Reference in New Issue
Block a user