uWSGI无法加载virtualenv

我正在使用nginx和uWSGI设置一个Python应用程序。 我的依赖是在virtualenv。 如果我手动激活virtualenv,所有的东西都可以运行这个命令:

uwsgi --ini uwsgi.ini 

但是,如果我尝试运行与virtualenv停用相同的命令,我得到这在输出(虽然没有具体的权限错误):

 *** no app loaded. going in full dynamic mode *** 

同样,当Emperor加载ini文件时,它不能运行该应用程序。 我的理解是,使用home选项应该激活virtualenv,但它似乎没有工作。 (加载的wsgi.py模块也激活了virtualenv,所以我甚至不知道为什么我需要这样做之前…)

这是我的uwsgi.ini

 [uwsgi] uid = 1000 socket = 127.0.0.1:8000 workers = 3 master = true processes = 5 module = wsgi:application chdir = /home/laststatement/app/laststatement home = /home/laststatement/.virtualenvs/last logto = /home/laststatement/log/uwsgi.log 

这是uWSGI日志:

 machine: x86_64 clock source: unix pcre jit disabled detected number of CPU cores: 1 current working directory: /etc/uwsgi/apps-enabled detected binary path: /usr/bin/uwsgi-core uWSGI running as root, you can use --uid/--gid/--chroot options setuid() to 1000 your processes number limit is 3750 your memory page size is 4096 bytes detected max file descriptor number: 1024 lock engine: pthread robust mutexes thunder lock: disabled (you can enable it with --thunder-lock) uwsgi socket 0 bound to TCP address 127.0.0.1:8000 fd 3 your server socket listen backlog is limited to 100 connections your mercy for graceful operations on workers is 60 seconds mapped 436752 bytes (426 KB) for 5 cores *** Operational MODE: preforking *** *** no app loaded. going in full dynamic mode *** *** uWSGI is running in multiple interpreter mode *** !!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!! no request plugin is loaded, you will not be able to manage requests. you may need to install the package for your language of choice, or simply load it with --plugin. !!!!!!!!!!! END OF WARNING !!!!!!!!!! spawned uWSGI master process (pid: 834) spawned uWSGI worker 1 (pid: 838, cores: 1) spawned uWSGI worker 2 (pid: 839, cores: 1) spawned uWSGI worker 3 (pid: 840, cores: 1) spawned uWSGI worker 4 (pid: 841, cores: 1) spawned uWSGI worker 5 (pid: 842, cores: 1) -- unavailable modifier requested: 0 -- announcing my loyalty to the Emperor... -- unavailable modifier requested: 0 -- announcing my loyalty to the Emperor... 

你显然正在运行2个不同的uWSGI版本。 一个是embedded了python插件的virtualenv,另一个是你没有加载python插件的系统范围:

!!!!!!!!!!!!!! WARNING !!!!!!!!!!!!!! no request plugin is loaded, you will not be able to manage requests. you may need to install the package for your language of choice, or simply load it with --plugin. !!!!!!!!!!! END OF WARNING !!!!!!!!!!

只需安装uwsgi python插件并使用plugin = python启用即可