[英]FastCGI WSGI library in Python 3?
Does there exist any library that can serve a WSGI application as a FastCGI server, for Python 3? 对于Python 3,是否存在可以作为FastCGI服务器为WSGI应用程序提供服务的库? (So that nginx could then proxy requests to it?)
(那么nginx可以代理请求吗?)
The Python 3 docs mention flup , but flup doesn't even install in Python 3: Python 3文档提到了flup ,但是flup甚至没有安装在Python 3中:
% env3/bin/pip install flup Downloading/unpacking flup Downloading flup-1.0.2.tar.gz (49kB): 49kB downloaded Running setup.py (path:/Users/me/tmp/env3/build/flup/setup.py) egg_info for package flup Traceback (most recent call last): File "", line 17, in File "/Users/me/tmp/env3/build/flup/setup.py", line 2, in from ez_setup import use_setuptools File "./ez_setup.py", line 98 except pkg_resources.VersionConflict, e: ^ SyntaxError: invalid syntax Complete output from command python setup.py egg_info: Traceback (most recent call last): File "", line 17, in File "/Users/me/tmp/env3/build/flup/setup.py", line 2, in from ez_setup import use_setuptools File "./ez_setup.py", line 98 except pkg_resources.VersionConflict, e: ^ SyntaxError: invalid syntax ---------------------------------------- Cleaning up... Command python setup.py egg_info failed with error code 1 in [snip] Storing debug log for failure in [snip]
There is now module called flup6
. 现在有一个名为
flup6
模块。 Install it using pip
使用
pip
安装它
./pip install flup6
You can use flup-py3
to solve this problem, as : 您可以使用
flup-py3
来解决此问题,如下所示:
pip3 install flup-py3
You may need super user privilge to execute this command. 您可能需要超级用户权限才能执行此命令。
I am aware of two options 我知道有两种选择
Both support Python 3 and both can create WSGI workers based on other web app code and can be served to NGINX. 两者都支持Python 3,并且两者都可以基于其他Web应用程序代码创建WSGI工作程序,并且可以提供给NGINX。
As Graham Dumpleton mentioned, CherryPy talks to NGINX via HTTP protocol, while uWSGI talks the 'uwsgi' protocol to nginx instead of the HTTP protocol, although it does also support using HTTP as well. 正如Graham Dumpleton所说,CherryPy通过HTTP协议与NGINX对话,而uWSGI将'uwsgi'协议与nginx而不是HTTP协议进行对话,尽管它也支持使用HTTP。 On the application side, both support hosting Python web applications via the WSGI API.
在应用程序方面,它们都支持通过WSGI API托管Python Web应用程序。
flipflop
instead flipflop
pip3 install --upgrade flipflop
flipflop
is what did the trick for me. flipflop
是我的诀窍。 flup-py3
has an unresolved issue which has been standing open for a couple of years now. flup-py3
有一个尚未解决的问题 ,现在已经开放了几年。
Do not forget to edit the import line in your .fcgi
script to reflect this change towards using flipflop
. 不要忘记编辑
.fcgi
脚本中的导入行以反映使用flipflop
这一变化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.