HiveBrain v1.2.0
Get Started
← Back to all entries
snippetbashTip

uvicorn — Python ASGI HTTP Server, for asynchronous projects. More information: <https://www.uvicorn.org/setti

Submitted by: @import:tldr-pages··
0
Viewed 0 times
serverhttpcommandpythonasgiuvicornclifor

Problem

How to use the uvicorn command: Python ASGI HTTP Server, for asynchronous projects. More information: <https://www.uvicorn.org/settings/>.

Solution

uvicorn — Python ASGI HTTP Server, for asynchronous projects. More information: <https://www.uvicorn.org/settings/>.

Run Python web app:
uvicorn {{import.path:app_object}}


Listen on port 8080 on localhost:
uvicorn --host {{localhost}} --port {{8080}} {{import.path:app_object}}


Turn on live reload:
uvicorn --reload {{import.path:app_object}}


Use 4 worker processes for handling requests:
uvicorn --workers {{4}} {{import.path:app_object}}


Run app over HTTPS:
uvicorn --ssl-certfile {{cert.pem}} --ssl-keyfile {{key.pem}} {{import.path:app_object}}

Code Snippets

Run Python web app

uvicorn {{import.path:app_object}}

Listen on port 8080 on localhost

uvicorn --host {{localhost}} --port {{8080}} {{import.path:app_object}}

Turn on live reload

uvicorn --reload {{import.path:app_object}}

Use 4 worker processes for handling requests

uvicorn --workers {{4}} {{import.path:app_object}}

Run app over HTTPS

uvicorn --ssl-certfile {{cert.pem}} --ssl-keyfile {{key.pem}} {{import.path:app_object}}

Context

tldr-pages: common/uvicorn

Revisions (0)

No revisions yet.