Python 3中的FastCGI WSGI库?

2024-04-23 21:05:03 发布

您现在位置:Python中文网/ 问答频道 /正文

对于Python 3,是否存在可以将WSGI应用程序用作FastCGI服务器的库?(这样nginx就可以将请求代理给它?)

The Python 3 docs提到了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]

Tags: infrompybuildinfoeggsetupline
3条回答

现在有一个名为flup6的模块。使用pip安装

./pip install flup6

您可以使用flipflop。它是一个简化的flup分支(只包含FastCGI部分),可以与Python 3一起使用。

您可以使用flup-py3来解决此问题,如下所示:

pip3 install flup-py3

您可能需要超级用户权限才能执行此命令。

相关问题 更多 >