Назад | Перейти на главную страницу

uWSGI не может загрузить virtualenv

Я настраиваю приложение Python с помощью nginx и uWSGI. Мои зависимости находятся в virtualenv. Если я активирую virtualenv вручную, все будет работать, выполнив эту команду:

uwsgi --ini uwsgi.ini

Но если я попытаюсь запустить ту же команду с деактивированным virtualenv, я получу это на выходе (однако никаких конкретных ошибок разрешений):

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

Точно так же, когда Emperor загружает ini-файл, он не может запустить приложение. Насколько я понимаю, использование home опция должна активировать virtualenv, но, похоже, она не работает. (The 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. Один в virtualenv со встроенным плагином python и общесистемный, для которого вы не загрузили плагин 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