Skip to content

Instantly share code, notes, and snippets.

@huanghe314
Created June 15, 2018 09:37
Show Gist options
  • Save huanghe314/9da4ab1dc4a4bb6917d2776936006f28 to your computer and use it in GitHub Desktop.
Save huanghe314/9da4ab1dc4a4bb6917d2776936006f28 to your computer and use it in GitHub Desktop.
uWSGI Tips

配置 uWSGI:

(venv)$ pip install uwsgi                           # 安装 uWSGI

Running with wsgi.py file(wsgi.py is the file name with app. callable):

(venv)$ uwsgi --socket 127.0.0.1:8080 --protocol=http -w wsgi

Runing under virtualenv, -H to set virtualenv to python path.

(venv)$ uwsgi --socket 127.0.0.1:8080 --protocol=http -H ./venv -w wsgi 

Supplying the pidfile option

(venv)$ uwsgi  ..... --pidfile=/tmp/uwsgi.pid
$ kill -HUP `cat /tmp/uwsgi.pid`     # using kill to send the signal, gracefully reload all the workers and the master process
$ kill -INT `cat /tmp/uwsgi.pid`     # immediately kill the entire uWSGI stack
(venv)$  uwsgi --reload  /tmp/uwsgi.pid  # or the convenience option --reload

Remember that you can only reload uWSGI when it’s running with the master process mode, but that’s usually the case though.

(venv)$ uwsgi  ..... --master   # enable master process

Ref:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment