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

gunicorn — Python WSGI HTTP Server. More information: <https://docs.gunicorn.org/en/latest/run.html>.

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

Problem

How to use the gunicorn command: Python WSGI HTTP Server. More information: <https://docs.gunicorn.org/en/latest/run.html>.

Solution

gunicorn — Python WSGI HTTP Server. More information: <https://docs.gunicorn.org/en/latest/run.html>.

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


Listen on port 8080 on localhost:
gunicorn {{[-b|--bind]}} {{localhost}}:{{8080}} {{import.path:app_object}}


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


Use 4 worker processes for handling requests:
gunicorn {{[-w|--workers]}} {{4}} {{import.path:app_object}}


Use 4 worker threads for handling requests:
gunicorn --threads {{4}} {{import.path:app_object}}


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

Code Snippets

Run Python web app

gunicorn {{import.path:app_object}}

Listen on port 8080 on localhost

gunicorn {{[-b|--bind]}} {{localhost}}:{{8080}} {{import.path:app_object}}

Turn on live reload

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

Use 4 worker processes for handling requests

gunicorn {{[-w|--workers]}} {{4}} {{import.path:app_object}}

Use 4 worker threads for handling requests

gunicorn --threads {{4}} {{import.path:app_object}}

Context

tldr-pages: common/gunicorn

Revisions (0)

No revisions yet.