Skip to content

Instantly share code, notes, and snippets.

@owen800q
Last active September 19, 2019 09:20
Show Gist options
  • Select an option

  • Save owen800q/a220b0023d9dbc098334b6a8ecab2568 to your computer and use it in GitHub Desktop.

Select an option

Save owen800q/a220b0023d9dbc098334b6a8ecab2568 to your computer and use it in GitHub Desktop.
Flask deployment
 uwsgi --socket 0.0.0.0:5000 --plugin python --protocol=http --wsgi-file wsgi.py 
open("/usr/lib/uwsgi/plugins/python_plugin.so"): No such file or directory [core/utils.c line 3691]
!!! UNABLE to load uWSGI plugin: /usr/lib/uwsgi/plugins/python_plugin.so: cannot open shared object file: No such file or directory !!!
uwsgi: unrecognized option '--wsgi-file'
getopt_long() error

Solution:

cd /usr/lib/uwsgi/plugins
ln -s ./python_plugin.so ./python_plugin.so

app.py

app = Flask(__name__)
if __name__=='__main__':
    app.run()

uwsgi.py

from app import app

if __name__ == '__main__':
    app.run()

run

uwsgi --socket 127.0.0.1:5000 --processes 4 --threads 8 --protocol=http --wsgi-file uwsgi.py --callab app

pypy2.7

uwsgi --socket 127.0.0.1:5000 --processes 4 --threads 8 --protocol=ht --pypy-lib ./venv/bin/libpypy3-c.so --pypy-wsgi-file uwsgi.py --pypy-setup ./pypy_setup.py 

pypy_setup.py can be download from uwsgi-pypy-python3

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