uwsgi:无法识别的选项'--module = MyProject.wsgi:application'

seb*_*piq 13 django uwsgi

我按照https://docs.djangoproject.com/en/dev/howto/deployment/wsgi/uwsgi/中的说明操作,直到几天前,当我杀死uwsgi进程并尝试重新启动时,它工作正常.然后它说

uwsgi: unrecognized option '--module=MyProject.wsgi:application'
Run Code Online (Sandbox Code Playgroud)

我一直在试图解决这个问题,...我检查了我的提交历史记录,我用来启动uwsgi的脚本没有改变:

#!/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
Run Code Online (Sandbox Code Playgroud)

显然一些事情必定已经改变,但我看不出...我没有运行任何更新,脚本没有改变...... PlEaSe HeLp !!!

Sin*_*ion 34

您可能需要--plugins在命令行中添加该选项以使用已安装的系统uwsgi.至少在Fedora 17上,这对我来说是必要的:

$ 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
$
Run Code Online (Sandbox Code Playgroud)

但这有效:

$ 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]
Run Code Online (Sandbox Code Playgroud)

  • 我发现参数的顺序很重要。如果我在传递 --plugins python 之前尝试传递 --wsgi-file 参数,它似乎不起作用。我收到一条消息,上面写着“未重新定义的参数”。 (3认同)

And*_*tis 15

最近,当我尝试在Unbuntu 12.04 repo(1.0.3)中使用uWSGI版本时,我遇到了这个问题.看起来这个版本有点老了.只需用pip抓住它(1.2.5).

pip install uwsgi
Run Code Online (Sandbox Code Playgroud)