Add async support

This allows for async functions to be passed to the Flask class
instance, for example as a view function,

    @app.route("/")
    async def index():
        return "Async hello"

this comes with a cost though of poorer performance than using the
sync equivalent.

asgiref is the standard way to run async code within a sync context,
and is used in Django making it a safe and sane choice for this.
This commit is contained in:
pgjones 2020-07-06 20:54:26 +01:00 committed by David Lord
parent 85b8fab268
commit 6979265fa6
No known key found for this signature in database
GPG key ID: 7A1C87E3F5BC42A8
11 changed files with 165 additions and 9 deletions

View file

@ -67,6 +67,8 @@ Unreleased
- Add route decorators for common HTTP methods. For example,
``@app.post("/login")`` is a shortcut for
``@app.route("/login", methods=["POST"])``. :pr:`3907`
- Support async views, error handlers, before and after request, and
teardown functions. :pr:`3412`
Version 1.1.2