我在云服务器上运行了一个python应用程序(Django + nginx + uWSGI)。
但是当我输入时,我无法启动uWSGI,
sudo uwsgi --uid www-data --gid www-data --emperor /etc/uwsgi/vassals
这是uWSGI文件的日志。 (uwsgi.mySite.log)
*** Starting uWSGI 2.0.3 (32bit) on [Wed Apr 2 00:43:45 2014] ***
compiled with version: 4.6.3 on 02 April 2014 00:40:56
os: Linux-3.2.0-34-generic-pae #53-Ubuntu SMP Thu Nov 15 11:11:12 UTC 2012
nodename: eb9c1026-428e-43d4-b7fc-ee92761848bd
machine: i686
clock source: unix
pcre jit disabled
detected number of CPU cores: 1
current working directory: /etc/uwsgi/vassals
writing pidfile to /var/www/mySiteDomain/logs/uwsgi.mySite.pid
detected binary path: /usr/local/bin/uwsgi
your processes number limit is 7683
your memory page size is 4096 bytes
*** WARNING: you have enabled harakiri without post buffering. Slow upload could be rejected on post-unbuffered webservers ***
detected max file descriptor number: 1024
VirtualHosting mode enabled.
lock engine: pthread robust mutexes
thunder lock: disabled (you can enable it with --thunder-lock)
uwsgi socket 0 bound to UNIX address /dev/shm/mySite.sock fd 3
Python version: 2.7.3 (default, Feb 27 2014, 20:11:37) [GCC 4.6.3]
Set PythonHome to /root/.virtualenvs/mySite
ImportError: No module named site
VACUUM: pidfile removed.
VACUUM: unix socket /dev/shm/mySite.sock removed.
似乎是uWSGI找不到python模块。
nginx没问题。
这是我的uWSGI ini文件。
[uwsgi]
## variables
username = root
projectname = mySite
projectdomain = mySiteDomain
base = /var/www/%(projectdomain)
## config
uid = www-data
gid = www-data
vhost = true
# master
master = true
# maximum number of processes
processes = 10
# respawn processes taking more than 20 seconds
harakiri = 20
# the socket (use the full path to be safe)
socket = /dev/shm/%(projectname).sock
# with appropriate permissions - *may* be needed
chmod-socket = 775
enable-threads = true
# the base directory
chdir = %(base)
# Django's wsgi file
module = %(projectname).wsgi
# the virtualenv
home = /%(username)/.virtualenvs/%(projectname)
# clear environment on exit
vacuum = true
max-request = 5000
daemonize = %(base)/logs/uwsgi.%(projectname).log
pidfile = %(base)/logs/uwsgi.%(projectname).pid
我检查过" site.py"位于/root/.virtualenvs/mySite/lib/python2.7
我也尝试将家(在uWSGI ini文件中)更改为" /%(用户名)/。virtualenvs /%(projectname)/lib/python2.7" ;,但我得到了同样的错误。
Virtualenv的sys.path还包括这些python路径。
我不知道出了什么问题。谢谢你的帮助。