![]() ![]() To run under PyPy you'll want to use pure-python implementation instead. The UvicornWorker implementation uses the uvloop and httptools implementations. The following will start Gunicorn with four worker processes: Uvicorn includes a gunicorn worker class that means you can get set up with very little configuration. Gunicorn is probably the simplest way to run and manage Uvicorn in a production setting. Uvicorn provides a lightweight way to run multiple worker processes, for example -workers 4, but does not provide any process monitoring. Running Uvicorn using a process manager ensures that you can run multiple processes in a resilient manner, and allows you to perform server upgrades without dropping requests.Ī process manager will handle the socket setup, start-up multiple server processes, monitor process aliveness, and listen for signals to provide for processes restarts, shutdowns, or dialing up and down the number of running processes. The reload and workers parameters are mutually exclusive. ![]() To run directly from within a Python program, you should use n(app, **config). See the settings documentation for more details on the supported options for running uvicorn. factory Treat APP as an application factory, i. h11 - max - incomplete - event - size INTEGER For h11, the maximum number of bytes to buffer of an incomplete event. Defaults to the current working directory. app - dir TEXT Look for APP in the specified directory, by adding this to the PYTHONPATH. ssl - keyfile TEXT SSL key file - ssl - certfile TEXT SSL certificate file - ssl - keyfile - password TEXT SSL keyfile password - ssl - version INTEGER SSL version to use ( see stdlib ssl module 's) - ssl - cert - reqs INTEGER Whether client certificate is required ( see stdlib ssl module 's) - ssl - ca - certs TEXT CA certificates file - ssl - ciphers TEXT Ciphers to use ( see stdlib ssl module 's) - header TEXT Specify custom default HTTP response headers as a Name : Value pair - version Display the uvicorn version and exit. timeout - keep - alive INTEGER Close Keep - Alive connections if no new data is received within this timeout. backlog INTEGER Maximum number of connections to hold in backlog - limit - max - requests INTEGER Maximum number of requests to service before terminating the process. limit - concurrency INTEGER Maximum number of concurrent connections or tasks to allow, before issuing HTTP 503 responses. root - path TEXT Set the ASGI 'root_path' for applications submounted below a given URL path. Defaults to the $ FORWARDED_ALLOW_IPS environment variable if available, or '127.0.0.1'. forwarded - allow - ips TEXT Comma separated list of IPs to trust with proxy headers. date - header / - no - date - header Enable / Disable default Date header. server - header / - no - server - header Enable / Disable default Server header. proxy - headers / - no - proxy - headers Enable / Disable X - Forwarded - Proto, X - Forwarded - For, X - Forwarded - Port to populate remote address info. 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. interface Select ASGI3, ASGI2, or WSGI as the application interface. ![]() ws - max - size INTEGER WebSocket max size message in bytes - ws - ping - interval FLOAT WebSocket ping interval - ws - ping - timeout FLOAT WebSocket ping timeout - ws - per - message - deflate BOOLEAN WebSocket per - message - deflate compression - lifespan Lifespan implementation. Defaults to the $ WEB_CONCURRENCY environment variable if available, or 1. workers INTEGER Number of worker processes. reload - delay FLOAT Delay between previous and next check if application needs to be. This option has no effect unless watchfiles is installed. sw.*, ~* ' by default these defaults can be overridden with ` - reload - include `. reload - exclude TEXT Set glob patterns to exclude while watching for files. Includes '*.py' by default these defaults can be overridden with ` - reload - exclude `. reload - include TEXT Set glob patterns to include while watching for files. reload - dir PATH Set reload directories explicitly, instead of using the current working directory. fd INTEGER Bind to socket from this file descriptor. $ uvicorn - help Usage : uvicorn APP Options : - host TEXT Bind socket to this host. ![]()
0 Comments
Leave a Reply. |