Python uWSGI:未加载请求插件,您将无法管理请求

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20176959/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 19:46:13  来源:igfitidea点击:

uWSGI: No request plugin is loaded, you will not be able to manage requests

pythonuwsgi

提问by 010110110101

I've loaded uWSGI v 1.9.20, built from source. I'm getting this error, but how do I tell which plugin is needed?

我已经加载了从源代码构建的 uWSGI v 1.9.20。我收到此错误,但如何判断需要哪个插件?

!!!!!!!!!!!!!! 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 !!!!!!!!!!

Which plugin should be loaded?

应该加载哪个插件?

采纳答案by KVISH

I had this problem and was stuck for hours.

我遇到了这个问题并且被困了几个小时。

my issue is different than the answer listed, make sure you have plugins = pythonin your uwsgi ini file and you install the uwsgi pythonplugin:

我的问题与列出的答案不同,请确保您plugins = python的 uwsgi ini 文件中有并安装uwsgi python插件:

sudo apt-get install uwsgi-plugin-python

After I did the above my application worked. Obviously this is for pythonprojects, but a similar approach is required for other projects.

完成上述操作后,我的应用程序工作了。显然这是针对python项目的,但其他项目也需要类似的方法。

回答by gitaarik

It might be easiest to install uwsgi through pip instead of the package manager from the OS you're using, the package in pip is usually more up to date than the package managers from the OS you might be using:

通过 pip 而不是您正在使用的操作系统中的包管理器安装 uwsgi 可能是最简单的,pip 中的包通常比您可能使用的操作系统中的包管理器更新:

sudo pip install uwsgi

This solved it for me anyway.

无论如何,这为我解决了它。

For using multiple Python versions on the same server, I would advice to take a look at virtualenv:
https://virtualenv.pypa.io/en/latest/

要在同一台服务器上使用多个 Python 版本,我建议查看 virtualenv:https://virtualenv.pypa.io/en/latest/

回答by Raffi

On my side, this is because instead of having [uwsgi]as the header of my configuration inside /etc/uwsgi/apps-available/, I put something else (the name of the app).

就我而言,这是因为[uwsgi]我没有在里面作为我的配置的标题/etc/uwsgi/apps-available/,而是放了其他东西(应用程序的名称)。

回答by Jimmy_Rw

I had similar issue but this solved it (btw, I use MacOs, and both python2&3 versions installed, but I wanted to use Python3):

我有类似的问题,但这解决了它(顺便说一句,我使用 MacOs,并且安装了 python2&3 版本,但我想使用 Python3):

  • Open terminal and check for python3 location by typing:
  • 打开终端并通过键入以下内容检查 python3 位置:

which python3

哪个python3

  • Copy the full path and assign it to; pluginsoption in .inifile
  • 复制完整路径并将其分配给;.ini文件中的插件选项

I hope it helps!

我希望它有帮助!

回答by KT.

Just stumbled upon this error message and wasted a couple of hours, yet in my case the cause was different from everything mentioned in other answers already.

只是偶然发现此错误消息并浪费了几个小时,但在我的情况下,原因与其他答案中提到的所有内容都不同。

Suppose you just installed a local uWSGI version via pipinto your own virtualenv (e.g. as described here).

假设你刚刚安装通过本地uWSGI版本pip到你自己的virtualenv(例如描述这里)。

Suppose you are now trying to run your uWSGI server as root (because you want to serve the app as www-datauser, for example). This is how you would do it, right?

假设您现在尝试以 root 身份运行 uWSGI 服务器(例如,因为您想以www-data用户身份为应用程序提供服务)。这就是你要做的,对吧?

. venv/bin/activate
sudo uwsgi --ini your-app.ini

Wrong! Even though your local uwsgiis in your path after you activated your environment, this path is not passed into the sudocommand, and you are launching the system uwsgirather than your local one, which may be the source of endless confusion, like it was in my case.

错误的!即使您的本地uwsgi环境在您激活环境后在您的路径中,此路径也不会传递到sudo命令中,并且您正在启动系统uwsgi而不是您的本地系统,这可能是无休止的混乱之源,就像我的情况一样.

So, the solution in my case was to simply specify the full path:

因此,我的解决方案是简单地指定完整路径:

sudo /full/path/to/venv/bin/uwsgi --ini your-app.ini

回答by Fortune

If you've followed all the python plugin installation steps and uwsgi --plugin-liststill fails to list 0: pythonas one of the plugins, try restarting your computer. My uwsgi instance ran as a service (from Bash, use service status-allto see running services) and probably the updated config settings were loaded on service restart.

如果您已按照所有 python 插件安装步骤进行操作,uwsgi --plugin-list但仍无法将其0: python列为插件之一,请尝试重新启动计算机。我的 uwsgi 实例作为服务运行(来自 Bash,用于service status-all查看正在运行的服务),并且可能在服务重启时加载了更新的配置设置。

回答by Hojat Modaresi

if you are using python3:

如果您使用的是python3:

install plugin:

安装插件:

sudo apt install uwsgi-plugin-python3

add uwsgi python3 plugin line in your site config (.ini file):

在您的站点配置(.ini 文件)中添加 uwsgi python3 插件行:

plugins = python3

and if you want to list your uwsgi's python plugins list:

如果你想列出你的 uwsgi 的 python 插件列表:

ls -l /usr/lib/uwsgi/plugins/ | grep python

KEEP IN MIND python3 plugin is different from python2.

记住python3插件与python2不同。

If you do not define python's plugin uwsgi says:

如果你没有定义 python 的插件 uwsgi 说:

!!!!!!!!!!!!!! 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 !!!!!!!!!!

if you use python2's plugin and your venv is in python3 it says:

如果你使用 python2 的插件并且你的 venv 在 python3 中,它会说:

ImportError: No module named site