Skip to main content
 首页 » 编程设计

python之当 uwsgi 构建为整体式(内置插件)并通过 dnf 在 Fedora 上安装时如何使用它

2025年02月15日10shihaiming

我一直在努力解决可怕的 no site error on uWSGI .

发生的事情是,当我将 python3 指定为插件时,它似乎总是想要加载 python 2.7。

当我运行 uwsgi --plugins-list` 时,我返回:

$ uwsgi --plugins-list 
 
*** uWSGI loaded generic plugins *** 
gevent 
nagios 
rrdtool 
carbon 
corerouter 
fastrouter 
http 
ugreen 
syslog 
rsyslog 
logsocket 
router_uwsgi 
router_redirect 
router_basicauth 
zergpool 
redislog 
mongodblog 
router_rewrite 
router_http 
logfile 
router_cache 
rawrouter 
router_static 
sslrouter 
cheaper_busyness 
transformation_tofile 
transformation_gzip 
transformation_chunked 
transformation_offload 
router_memcached 
router_redis 
router_hash 
router_expires 
router_metrics 
transformation_template 
stats_pusher_socket 
 
*** uWSGI loaded request plugins *** 
0: python 
17: spooler 
18: symcall 
100: ping 
110: signal 
111: cache 
173: rpc 
--- end of plugins list --- 

在工作的 CentOS 服务器上,当我运行 uwsgi --plugins-list 时,我返回:

# uwsgi --plugins-list 
 
*** uWSGI loaded generic plugins *** 
corerouter 
 
*** uWSGI loaded request plugins *** 
100: ping 
101: echo 
--- end of plugins list --- 
 
*** Starting uWSGI 2.0.14 (64bit) on [Sun Jan  8 11:42:22 2017] *** 
compiled with version: 4.8.5 20150623 (Red Hat 4.8.5-4) on 05 October 2016 20:03:58 
os: Linux-3.10.0-327.36.3.el7.x86_64 #1 SMP Mon Oct 24 16:09:20 UTC 2016 

我使用 dnf 在 Fedora 上安装了 uwsgi。在 CentOS 上,它来自 yum。如果答案是通过 pip 安装,我会感到非常惊讶,因为这意味着 Fedroa 库存版本的使用受到限制,因为它是整体编译的。

请您参考如下方法:

Fedora 和 EPEL(用于 CentOS)中的 uwsgi 包以大多数插件(python、ruby、psgi、php 等)必须显式加载的方式构建。当您从 PyPI 安装 uwsgi 时,它默认构建为 python 插件。因此,为了使其在通过 RPM 安装时能够正常工作,请像这样运行它:

uwsgi --plugin python <then the rest of your normal arguments> 

或

uwsgi --plugin python3 <then the rest of your normal arguments>