support app factory patten in CLI (#2157)

* support app factory patten in CLI

* Update sanic/__main__.py

* fix mypy errors

* Update mypy further

* Update sanic/utils.py

* Update sanic/utils.py

* support hypercorn/gunicorn style 'asgi.app:create_app()'

* add test for app factory
This commit is contained in:
Thomas Grainger
2021-06-09 10:05:56 +01:00
committed by GitHub
parent 141be0028d
commit 48f8b37b74
5 changed files with 33 additions and 4 deletions

View File

@@ -30,3 +30,7 @@ async def app_info_dump(app: Sanic, _):
@app.after_server_start
async def shutdown(app: Sanic, _):
app.stop()
def create_app():
return app