shutdown_trigger
that I think is the issue for you. This is set by default to be a signal (Ctrl-C), but as noted this is only works if Quart is run on the main thread. Instead you can specify your own shutdown_trigger
and use the run_task
method. The shutdown_trigger
should be an awaitable that is done when you want the app to shutdown.
Hi.
I've just updated quart, quart-trio and hypercorn and I'm having this mypy error:
: error: Argument 1 to "serve" has incompatible type "QuartTrio"; expected "Union[Type[ASGI2Protocol], Callable[[Union[HTTPScope, WebsocketScope, LifespanScope], Callable[[], Awaitable[Union[HTTPRequestEvent, HTTPDisconnectEvent, WebsocketConnectEvent, WebsocketReceiveEvent, WebsocketDisconnectEvent, LifespanStartupEvent, LifespanShutdownEvent]]], Callable[[Union[HTTPResponseStartEvent, HTTPResponseBodyEvent, HTTPServerPushEvent, HTTPDisconnectEvent, WebsocketAcceptEvent, WebsocketSendEvent, WebsocketResponseStartEvent, WebsocketResponseBodyEvent, WebsocketCloseEvent, LifespanStartupCompleteEvent, LifespanStartupFailedEvent, LifespanShutdownCompleteEvent, LifespanShutdownFailedEvent]], Awaitable[None]]], Awaitable[None]]]"
moves\web\__init__.py:85: error: Argument 1 to "serve" has incompatible type "QuartTrio"; expected "Union[Type[ASGI2Protocol], Callable[[Union[HTTPScope, WebsocketScope, LifespanScope], Callable[[], Awaitable[Union[HTTPRequestEvent, HTTPDisconnectEvent, WebsocketConnectEvent, WebsocketReceiveEvent, WebsocketDisconnectEvent, LifespanStartupEvent, LifespanShutdownEvent]]], Callable[[Union[HTTPResponseStartEvent, HTTPResponseBodyEvent, HTTPServerPushEvent, HTTPDisconnectEvent, WebsocketAcceptEvent, WebsocketSendEvent, WebsocketResponseStartEvent, WebsocketResponseBodyEvent, WebsocketCloseEvent, LifespanStartupCompleteEvent, LifespanStartupFailedEvent, LifespanShutdownCompleteEvent, LifespanShutdownFailedEvent]], Awaitable[None]]], Awaitable[None]]]"
the "incriminated" line is await hypercorn.trio.serve(app, config)
, where I have
app = cast(quart_trio.QuartTrio,
quart_cors.cors(quart_trio.QuartTrio(__name__),
allow_origin='*',
allow_methods=['POST'],
allow_headers=['content-type']))
It is the usage of the
shutdown_trigger
that I think is the issue for you. This is set by default to be a signal (Ctrl-C), but as noted this is only works if Quart is run on the main thread. Instead you can specify your ownshutdown_trigger
and use therun_task
method. Theshutdown_trigger
should be an awaitable that is done when you want the app to shutdown.
Thanks!
It is the usage of the
shutdown_trigger
that I think is the issue for you. This is set by default to be a signal (Ctrl-C), but as noted this is only works if Quart is run on the main thread. Instead you can specify your ownshutdown_trigger
and use therun_task
method. Theshutdown_trigger
should be an awaitable that is done when you want the app to shutdown.Thanks!
hello! apologies for poorly phrased questions in advance, i am very new to python frameworks and asyncio!
i am still having a hard time to get this to work -- trying to run a quart app to be used on a website along with bot that runs 24/7 on discord. my understanding is that this run_task() method would be run for the quart app?
scope['query_string']
and the headers etc again myself
GitLab
? Thanks your help in advance.
RuntimeError: Flask Patching only works with the default event loop policy
.0.0.0.0
it means that on localhost it will 127.0.0.1
on wireless it will 10.42.1.12
and etc. So is it possible to know all? Thanks in advance!