Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

uwsgi: unrecognized option '--module=MyProject.wsgi:application'

Tags:

django

uwsgi

I followed the instructions in https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/ and it was working fine until a few days ago, when I killed the uwsgi processes and tried to restart again. Then it said

uwsgi: unrecognized option '--module=MyProject.wsgi:application'

I've been banging my head trying to solve that problem, ... I've checked my commit history and the script I use to start uwsgi hasn't changed :

#!/bin/bash
# https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/
uwsgi --chdir=/home/MyProject \
    --module=MyProject.wsgi:application \
    --env DJANGO_SETTINGS_MODULE=MyProject.settings \
    --master --pidfile=/tmp/MyProject-masted.pid \
    --socket=/home/MyProject.sock \
    --processes=5 \
    --harakiri=20 \
    --limit-as=128 \
    --max-requests=5000 \
    --vacuum \
    --home=/home/MyProject/env \
    --daemonize=/var/log/uwsgi/MyProject.log

Obviously something must have changed but I cant see what ... I didn't run any update, script didn't change ... PlEaSe HeLp !!!

like image 451
sebpiq Avatar asked Aug 30 '12 16:08

sebpiq


People also ask

Why is uWSGI needed?

uWSGI is often used in conjunction with web servers such as Cherokee and Nginx, which offer direct support for uWSGI's native uwsgi protocol, to serve Python web applications such as Django. For example, data may flow like this: HTTP client ↔ Nginx ↔ uWSGI ↔ Python app. A common alternative to uWSGI is Gunicorn.

What is uWSGI plugin Python?

uWSGI presents a complete stack for networked/clustered web applications, implementing message/object passing, caching, RPC and process management. It is designed to be fully modular. This means that different plugins can be used in order to add compatibility with tons of different technology on top of the same core.

What port does uWSGI run on?

The uWSGI HTTP/HTTPS router In standalone mode you have to specify the address of a uwsgi socket to connect to. This will spawn a HTTP server on port 8080 that forwards requests to a pool of 4 uWSGI workers managed by the master process.


2 Answers

You probably need to add the --plugins option to your command line to use the system installed uwsgi. On Fedora 17, at least, this is neccesary for me:

$ uwsgi --http 127.0.0.1:8000 --module=wsgiref.simple_server:demo_app
uwsgi: unrecognized option '--module=wsgiref.simple_server:demo_app'
getopt_long() error
$

but this works:

$ uwsgi --http 127.0.0.1:8000 --plugins python --module=wsgiref.simple_server:demo_app
*** Starting uWSGI 1.2.4 (64bit) on [Thu Aug 30 14:09:57 2012] ***
[.. snip]
like image 162
SingleNegationElimination Avatar answered Sep 23 '22 13:09

SingleNegationElimination


I ran into this recently when I tried to use the version of uWSGI in the Unbuntu 12.04 repo (1.0.3). It looks likes that version is a bit old. Just use pip to grab it (1.2.5).

pip install uwsgi
like image 29
AndrewJesaitis Avatar answered Sep 21 '22 13:09

AndrewJesaitis