Nginx和uwsgi问题(在EC2上实现)

时间:2014-02-28 00:30:52

标签: python sockets nginx amazon-ec2

我正在使用ec2 + uwsgi + django在Amazion AWS上设置网站,使用来自http://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html的说明。它完美无缺,直到我到达我试图用套接字

运行uwsgi的步骤

wsgi --socket mysite.sock --wsgi-file test.py'或'uwsgi --socket mysite.sock --wsgi-file test.py --chmod-socket = 666

(除了http,我们还没有使用uwsgi.ini,只是纯粹的命令),我们得到错误无法打开python文件。不知道为什么会发生这种情况

这是日志:

*** Operational MODE: single process ***
failed to open python file wsgi.py
unable to load app 0 (mountpoint='') (callable not found or import error)
*** no app loaded. going in full dynamic mode ***
*** uWSGI is running in multiple interpreter mode ***
spawned uWSGI worker 1 (and the only) (pid: 32084, cores: 1)

更新

我们在ubuntu机器上使用了相同的程序,它运行得很好!

1 个答案:

答案 0 :(得分:0)

对我来说很好。在运行virtualenv

之前,您必须确保使用uwsgi来源
virtualenv uwsgi-tutorial
cd uwsgi-tutorial
source bin/activate

您确定test.py的内容未使用wsgi吗?

例如,如果您查看其他帖子:Django, uWSGI, gevent loop - How to get to get to work - unable to load app 0 (mountpoint=''),则用户有一个wsgi.py文件正在使用wsgi类。

[编辑]

因为你没有使用virtualenv。确保您没有任何与uwsgi模块冲突的uwsgi安装。你是怎么安装uwsgi的?用pip?或使用该系统?确保您的uwsgi可执行文件位于/usr/local/bin下(如果您使用pip安装)

您也可以尝试删除系统uwsgi:

sudo apt-get remove uwsgi uwsgi-core

并重新安装uwsgi:

pip uninstall uwsgi
pip install uwsgi

希望它有所帮助。