How to import ext.injection?

class FakeConnection:
    async def execute(self, query: str, **arguments):
        return "result"

async def setup_db(app, _):
    app.ctx.db_conn = FakeConnection()

def get_db(request: Request):

ext.injection(FakeConnection, get_db)   # how to import ext.injection

async def handler(request, conn: FakeConnection):
    response = await conn.execute("...")
    return text(response)

I could not find the correct injection location using PyCharm’s auto_import

It is not imported. ext is a property of your Sanic instance.

1 Like

I find that the document of ext.injection page is different from that of other languages

If I want to modify the Chinese document, where do I need to go to get the demand?


On the bottom of the page is a link to the source that generates the page.