我正试图在python2.7中使我的web.py应用程序达到生产级别,如本文档在windows环境中所描述的那样。所以我把
生产-> LightTPD -> ..。用FastCGI
节在上面的页中。首先安装flup,然后添加
#!/usr/bin/env python给我的Code.py
然后我从这里下载了lighttpd,并提取了Lightttpd-1.4.39-1-IPv 6-Win32-SSL.zip。
接下来,我编辑了文档中提到的lighttpd.conf。由于我使用Windows,所以我使用了完整的路径来使其工作,如下所示。
server.modules = ("mod_fastcgi", "mod_rewrite")
server.document-root = "C:\Python27\New folder\LightTPD-1.4.39-1-IPv6-Win32-SSL\LightTPD\htdocs\Engine"
fastcgi.server = ( "\Code.py" =>
(( "socket" => "C:\Python27\New folder\LightTPD-1.4.39-1-IPv6-Win32-SSL\LightTPD\htdocs\Engine\tmp\fastcgi.socket",
"bin-path" => "C:\Python27\New folder\LightTPD-1.4.39-1-IPv6-Win32-SSL\LightTPD\htdocs\Engine\Code.py",
"max-procs" => 1
))
)
url.rewrite-once = (
"^/favicon.ico$" => "/static/favicon.ico",
"^/static/(.*)$" => "/static/$1",
"^/(.*)$" => "/Code.py/$1"
)这是我的Code.py
#!/usr/bin/env python
__author__ = 'Marlon'
import web
import json
import time
urls = (
'/foo(.*)', 'Foo'
)
class Foo(web.storage):
def GET(self,r):
web.header('Access-Control-Allow-Origin', '*')
web.header('Access-Control-Allow-Credentials', 'true')
result = time.sleep(30)
return result
if __name__ == "__main__":
app = web.application(urls, globals())
app.run()当我试图从命令提示符运行LightTPD.exe时,它会给出这个错误。
2016-07-20 00:02:23: (server.c.645) trying to read configuration (test mode)
2016-07-20 00:02:23: (log.c.194) server started
2016-07-20 00:02:23: (mod_fastcgi.c.1102) the fastcgi-backend C:\Python27\New folder\LightTPD-1.4.39-1-IPv6-Win32-SSL\LightTPD\htdoc\Engine\Code.py failed to start:
2016-07-20 00:02:23: (mod_fastcgi.c.1106) child exited with status 2 C:\Python27\New folder\LightTPD-1.4.39-1-IPv6-Win32-SSL\LightTPD\htdoc\Engine\Code.py
2016-07-20 00:02:23: (mod_fastcgi.c.1109) If you're trying to run your app as a FastCGI backend, make sure you're using the FastCGI-enabled version.\nIf this is PHP on Gentoo, add 'fastcgi' to the USE flags.
2016-07-20 00:02:23: (mod_fastcgi.c.1395) [ERROR]: spawning fcgi failed.
2016-07-20 00:02:23: (server.c.1057) Configuration of plugins failed. Going down我需要安装任何与FastCGI相关的设备吗?我遇到过这,它要求安装这,但这并不适用于windows。我是否需要单独安装这个窗口,如果是的话,我可以在哪里得到它?是上述错误出现的问题吗?
发布于 2016-07-20 05:44:03
请试用本周早些时候发布的lighttpd 1.4.40。与以前的版本相比,它在Windows上运行得更好。您需要一个cygwin环境来从源代码构建它,但是可执行文件可以在cygwin环境之外运行。
https://stackoverflow.com/questions/38466392
复制相似问题