Skip to content

How to log Quart requests to file? #340

Answered by catwell
joshft91 asked this question in Q&A

You must be logged in to vote

The reason is that when you use the development server with app.run() Quart overrides the Hypercorn config.

You can either use Hypercorn directly (like described here), or do this:

from collections.abc import Awaitable, Callable, Coroutine

from hypercorn.asyncio import serve
from hypercorn.config import Config as HyperConfig

from quart import Quart


class App(Quart):
    def run_task(
        self,
        host: str = "127.0.0.1",
        port: int = 5000,
        debug: bool | None = None,
        ca_certs: str | None = None,
        certfile: str | None = None,
        keyfile: str | None = None,
        shutdown_trigger: Callable[..., Awaitable[None]] | None = None,
    ) -> Coroutine[

Replies: 1 comment 3 replies

You must be logged in to vote
3 replies
@joshft91

@catwell

Answer selected by joshft91
@joshft91

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants