问题
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 !!!
回答1:
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
回答2:
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]
来源:https://stackoverflow.com/questions/12201588/uwsgi-unrecognized-option-module-myproject-wsgiapplication