27

I am trying to run a Django app using uwsgi. Most instructions I have found refer to a "--wsgi-file" and "--module" to specify the application, but "uwsgi" makes no mention of these options, and when I try and use them:

uwsgi -s /tmp/uwsgi.sock --master --module myapp.wsgi
uwsgi: unrecognized option '--module'
getopt_long() error

And

uwsgi -s /tmp/uwsgi.sock --master --wsgi-file myapp/wsgi.py
uwsgi: unrecognized option '--wsgi-file'
getopt_long() error

When I run it without either, I get:

uwsgi -s /tmp/uwsgi.sock --master 
*** Starting uWSGI 2.0.9 (64bit) on [Fri Jul 10 11:12:04 2015] ***
compiled with version: 4.4.7 20120313 (Red Hat 4.4.7-11) on 23 April 2015 19:31:15
os: Linux-2.6.32-504.16.2.el6.x86_64 #1 SMP Tue Mar 10 17:01:00 EDT 2015
machine: x86_64
clock source: unix
pcre jit disabled
detected number of CPU cores: 2
detected binary path: /usr/sbin/uwsgi
your processes number limit is 1024
your memory page size is 4096 bytes
detected max file descriptor number: 1024
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /tmp/uwsgi.sock fd 5
your server socket listen backlog is limited to 100 connections
your mercy for graceful operations on workers is 60 seconds
mapped 145536 bytes (142 KB) for 1 cores
*** Operational MODE: single process ***
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI master process (pid: 26597)
spawned uWSGI worker 1 (pid: 26598, cores: 1)

Why aren't these options recognized? How am I supposed to specify the app to load? What kind of garbage software is this? Should I go back to using Gunicorn?

2
  • How did you install uwsgi? pip? Jul 10, 2015 at 1:41
  • 1
    @aaa90210 I found myself here because I had the maddening reaction as you did. LoL Most options didn't work, despite seeing countless examples online. Thanks for this post.
    – NYCeyes
    Oct 6, 2017 at 21:08

2 Answers 2

45

This means that the python plugin for uWSGI isn't installed or loaded. To verify run:

$ uwsgi --plugins-list

In general if you have build-essential python-dev etc., you can install via:

$ pip install uwsgi

On Debian or Ubuntu you can also install it via:

$ apt-get install uwsgi-plugin-python

On Linux Alpine you currently have to specify where it is:

$ apk add --update uwsgi-python
$ uwsgi --plugins-dir /usr/lib/uwsgi/ --need-plugin python --plugins-list
*** uWSGI loaded generic plugins ***

*** uWSGI loaded request plugins ***
0: python
...

Alternatively you can specify its full path via:

$ uwsgi --plugin /usr/lib/uwsgi/python_plugin.so --plugins-list
3
  • 4
    Still doesn't work for me. After installing both uwsgi-plugin-python and uwsgi-plugin-python3 running ` uwsgi --http-socket :9090 --wsgi-file ./respond.py --plugin /usr/lib/uwsgi/plugins/python3_plugin.so` still gets me the "unrecognized option" response.
    – Shadur
    Dec 21, 2017 at 16:39
  • 4
    @Shadur what helped me with a similar problem was specifying the --plugin ... argument before any plugin-specific argument. In your case, you could try: uwsgi --http-socket :9090 --plugin /usr/lib/uwsgi/plugins/python3_plugin.so --wsgi-file ./respond.py Sep 15, 2018 at 11:21
  • @shadur, you need to include --plugin python in your command after install stackoverflow.com/a/34638770/5042053 Apr 19, 2020 at 15:23
3

Depending how you installed uwsgi also might also need to install the python plugin. e.g.

apt-get install uwsgi-plugin-python

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.