Uwsgi

From wiki
Revision as of 12:41, 14 July 2021 by Hdridder (talk | contribs)
Jump to navigation Jump to search

Lots of confusion going around on the net about installing and using uwsgi. Here my notes.

Used documentation

https://github.com/unbit/uwsgi/issues/1688

https://www.digitalocean.com/community/tutorials/how-to-deploy-python-wsgi-applications-using-uwsgi-web-server-with-nginx

https://stackoverflow.com/questions/35262299/uwsgi-emperor-mode-not-working-outside-of-virtualenv

Installing

  • pip3 install uwsgi
  • Create virtual python environment
virtualenv --clear --always-copy -p /usr/bin/python3 venv
  • Activate the virtual environment and install flask
pip3 install flask

Now 1 application can be started (second is complaining about the python plugin and encodings module although the .ini is exactly the same)


Stopping

Several suggestions made on the web:

This works:

kill `pidof uwsgi`

Other suggestion that looks cleaner:

uwsgi --stop /run/uwsgi/pid (or whereever your pid-file is)