简体   繁体   English

如何在Windows上为Apache安装Python的flup? (使web.py工作)

[英]How to install Python's flup on Windows for Apache? (to make web.py work)

I recently began my work using web.py, but I'm stuck with a problem since web.py needs to have flup installed. 我最近开始使用web.py进行工作,但是由于web.py需要安装flup,所以我遇到了一个问题。

I downloaded flup from http://www.saddi.com ( download Link ) and then extracted it to a folder on my desktop. 我从http://www.saddi.com下载flup( 下载链接 ),然后将其解压缩到桌面上的文件夹中。

I then navigate to the folder and run setup.py install. 然后,我导航到该文件夹​​并运行setup.py install。 On success, I get an egg file in my C:\\Python27\\Lib\\site-packages . 成功后,我在C:\\Python27\\Lib\\site-packages获得一个egg文件。

However, upon running the code below (taken from webpy.org ): 但是,运行下面的代码(取自webpy.org )后:

#!/usr/bin/python

import web

urls = ("/.*", "hello")
app = web.application(urls, globals())

class hello: 
    def GET(self):
        return 'Hello, world!'

web.wsgi.runwsgi = lambda func, addr=None: web.wsgi.runfcgi(func, addr)
if __name__ == "__main__":
    app.run()

I get this error: 我收到此错误:

AttributeError: 'module' object has no
attribute 'fromfd'

Following this site 's advice, I intended to change the contents of a file called fcgi_base.py . 根据该站点的建议,我打算更改名为fcgi_base.py的文件的内容。 However this file is included in the said egg file. 然而,该文件包括在所述egg文件中。 What I want to know is how do I change this Python file? 我想知道的是如何更改此Python文件?

I think I can open the egg file with winrar and then edit the said file, but should I change it back to an egg file again to actually make it work? 我想我可以使用winrar打开egg文件,然后编辑该文件,但是我应该再次将其更改回egg文件以使其真正起作用吗?

Thank you for reading. 感谢您的阅读。 Also, if you've had experience making web.py work, your advice would be much appreciated. 另外,如果您有使web.py工作的经验,您的建议将不胜感激。

You need to specify the address and port that you've configured apache to forward to. 您需要指定配置了要转发到的apache的地址和端口。 For example, if you configured Apache's FCGI to forward to 127.0.0.1:8080 you would do: 例如,如果您将Apache的FCGI配置为转发到127.0.0.1:8080,则可以执行以下操作:

web.wsgi.runwsgi = lambda func, addr=('127.0.0.1', 8080): web.wsgi.runfcgi(func, addr)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM