以下是我用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()
答案 0 :(得分:1)
这是一个错字:
从= / home / ubuntu / workspace / htFrontEnd / htdjango / wsgi.py和= / home / ubuntu / workspace / htFrontEnd / htdjango
中删除=(等号)答案 1 :(得分: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吗?