1

这是我使用 uWSGI 启动 django 的方法。

command = /usr/local/bin/uwsgi --loop gevent --socket 127.0.0.1:8070 --processes 2 --pp =/home/ubuntu/workspace/htFrontEnd/htdjango --wsgi-file =/home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py -b 32768 --master --async 20 --enable-threads --listen 2048

这是我在日志中得到的错误......

wsgi.phy 的位置正确:/home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py

your memory page size is 4096 bytes
detected max file descriptor number: 1024
async fd table size: 1024
allocated 20800 bytes (20 KB) for 20 cores per worker.
lock engine: pthread robust mutexes
uwsgi socket 0 bound to TCP address 127.0.0.1:8070 fd 3
Python version: 2.7.3 (default, Aug  1 2012, 05:25:23)  [GCC 4.6.3]
Python main interpreter initialized at 0xab4ef0
python threads support enabled
your server socket listen backlog is limited to 2048 connections
*** Operational MODE: preforking+async ***
added =/home/ubuntu/workspace/htFrontEnd/htdjango to pythonpath.
failed to open python file =/home/ubuntu/workspace/htFrontEnd/htdjango/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 master process (pid: 1935)
spawned uWSGI worker 1 (pid: 2037, cores: 20)
spawned uWSGI worker 2 (pid: 2038, cores: 20)
*** running gevent loop engine [addr:0x44f950] ***
timeout. skip request.

这是我的 wsgi.py 文件。

import os
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "htdjango.settings")
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
4

2 回答 2

1

这是一个错字:

从 =/home/ubuntu/workspace/htFrontEnd/htdjango/wsgi.py 和 =/home/ubuntu/workspace/htFrontEnd/htdjango 中删除 =(等号)

于 2012-11-04T19:23:58.447 回答
0

我注意到这已经发生了——added =/home/ubuntu/workspace/htFrontEnd/htdjango to pythonpath.但可以肯定的是,你能否在文件中再添加一行wsgi.py——

`sys.path.append('/home/ubuntu/workspace/htFrontEnd/htdjango')`

当您再次尝试运行它时,让我知道您的标准输出中是否有任何其他变化。

application = get_wsgi_application()当这个错误消息告诉我们 uwsgi 找不到我们的 django 应用程序时,肯定有问题。

您是否有机会使用 virtualenv?而你的 django 库本身就在 virtualenv 中?

于 2012-11-04T14:27:15.577 回答