The certificate is at "localhost+2.pem" and the key at "localhost+2-key.pem" in our project folder. I like to rename the files as "cert.pem" and "key.pem" so its a bit easier on the eyes. Now we just need to tell Uvicorn the location of these files and Uvicorn will do all the HTTPS heavy-lifting for us.How to configure uvicorn?
You can also configure Uvicorn using environment variables with the prefix UVICORN_ . For example, in case you want to run the app on port 5000, just set the environment variable UVICORN_PORT to 5000. CLI options and the arguments for uvicorn.run () take precedence over environment variables.What is the difference between uvicorn and Gunicorn?
Uvicorn provides a lightweight way to run multiple worker processes, for example --workers 4, but does not provide any process monitoring. Gunicorn¶ Gunicorn is probably the simplest way to run and manage Uvicorn in a production setting. Uvicorn includes a gunicorn worker class that means you can get set up with very little configuration.What is uvicorn worker?
Uvicorn includes a gunicorn worker class that means you can get set up with very little configuration. The following will start Gunicorn with four worker processes: gunicorn -w 4 -k uvicorn.workers.UvicornWorker The UvicornWorkerimplementation uses the uvloopand httptoolsimplementations.