2014-02-28 88 views
0

我使用ec2 + uwsgi + django在Amazion AWS上设置网站,使用的指令来自:http://uwsgi.readthedocs.org/en/latest/tutorials/Django_and_nginx.html。它完美的工作,直到我到达了我试图运行与套接字uwsgi的步骤Nginx和uwsgi问题(在EC2上实现)

wsgi --socket mysite.sock --wsgi文件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的机器上相同的程序和它的工作就好了!

+0

你可以发布带日志的错误消息吗? – Rico

+0

刚刚添加了日志请求 – user3257548

回答

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 

希望它可以帮助。

+0

我们不使用virtualenv来实现。只是在默认环境下做...我认为应该更容易 – user3257548

+0

我添加了一些提示。希望能帮助到你。 – Rico

+0

是necesarry使用virtualenv运行wsgi ?,所以我使用码头。 –