Having an async concurrency model also allows for options such as lightweight background tasks,Īnd can be less of a limiting factor for endpoints that have long periods being blocked on network This doesn’t allow for long-lived connections, like you get with long-poll HTTP or WebSocket connections, WSGI applications are a single, synchronous callable that takes a request and returns a response. Most well established Python Web frameworks started out as WSGI-based frameworks. Import asyncio async def app ( scope, receive, send ): """ Send a slowly streaming HTTP response back to the client. If you're looking for a programmatic equivalent of the uvicorn command line interface, use n(): There are several ways to run uvicorn directly from your application. aįor more information, see the settings documentation. factory Treat APP as an application factory, i.e. app-dir TEXT Look for APP in the specified directory, byĪdding this to the PYTHONPATH. version Display the uvicorn version and exit. header TEXT Specify custom default HTTP response headers ssl-ciphers TEXT Ciphers to use (see stdlib ssl module's) ssl-cert-reqs INTEGER Whether client certificate is required (see ssl-version INTEGER SSL version to use (see stdlib ssl module's) ssl-keyfile-password TEXT SSL keyfile password timeout-keep-alive INTEGER Close Keep-Alive connections if no new data limit-max-requests INTEGER Maximum number of requests to service before backlog INTEGER Maximum number of connections to hold in limit-concurrency INTEGER Maximum number of concurrent connections or root-path TEXT Set the ASGI 'root_path' for applications $FORWARDED_ALLOW_IPS environment variable if forwarded-allow-ips TEXT Comma separated list of IPs to trust with use-colors / -no-use-colors Enable/Disable colorized logging. access-log / -no-access-log Enable/Disable access log. log-config PATH Logging configuration file. env-file PATH Environment configuration file. WebSocket per-message-deflate compression ws-ping-timeout FLOAT WebSocket ping timeout ws-ping-interval FLOAT WebSocket ping interval ws-max-queue INTEGER The maximum length of the WebSocket message ws-max-size INTEGER WebSocket max size message in bytes workers INTEGER Number of worker processes. reload-delay FLOAT Delay between previous and next check ifĪpplication needs to be. Option has no effect unless watchfiles is reload-exclude TEXT Set glob patterns to exclude while watchingįor files. Includes '*.py' by default theseĭefaults can be overridden with `-reload-Įxclude`. reload-include TEXT Set glob patterns to include while watchingįor files. reload-dir PATH Set reload directories explicitly, instead fd INTEGER Bind to socket from this file descriptor. PyYAML will be installed to allow you to provide a.python-dotenv will be installed should you want to use the -env-file option.windows users will have colorama installed for the colored logs. the -reload flag in development mode will use watchfiles.the websocket protocol will be handled by websockets (should you want to use wsproto you'd need to install it manually) if possible.Read more about comparison with h11 here.the http protocol will be handled by httptools if possible.The built-in asyncio event loop serves as an easy-to-read reference implementation and is there for easy debugging as it's pure-python based.uvloop is a fast, drop-in replacement of the built-in asyncio event loop.the event loop uvloop will be installed and used if possible.In this context, "Cython-based" means the following: This will install uvicorn with "Cython-based" dependencies (where possible) and other "optional extras".
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |