|
|
|
|
| 在windows下如何安装配置python cgi |
 在windows下如何安装配置python cgi - jason33 [ 2005-01-16 09:59 | 1,891 byte(s)]
 Re: 在windows下如何安装配置python cgi - limodou [ 2005-01-17 09:06 | 746 byte(s)]
|
|
|
|
[Original]
[Print]
[Top]
|
我的操作系统是windows2003
A 。我试了在iis下配置 python cgi 无法运行(按照windows2000的配置方法)
访问cgi脚本是总是cgi运行超时,不知哪里有问题。
B。 我又试了用python的 httpserver 和cgiserver
但是还是不行,html文件可以访问,但py的cgi脚本无法正常运行,
作为文本显示了出来。
测试脚本如下:
#!Python24python
#######################################################
# runs on the server, prints html to create a new page;
# executable permissions, stored in ~lutz/public_html,
# url=http://starship.python.net/~lutz/Basics/test0.cgi
#######################################################
print "Content-type: text/html
"
print "<TITLE>CGI 101</TITLE>"
print "<H1>A First CGI script</H1>"
print "<P>Hello, CGI World!</P>"
cgi服务器的程序如下:OReilly - Learning Python上的例子
#!pythonpython
############################################
# implement a HTTP server in Python which
# knows how to run server-side CGI scripts;
# change root dir for your server machine
############################################
import os
from BaseHTTPServer import HTTPServer
from CGIHTTPServer import CGIHTTPRequestHandler
os.chdir("cgi-bin") # run in html root dir
srvraddr = ("", 80) # my hostname, portnumber
srvrobj = HTTPServer(srvraddr, CGIHTTPRequestHandler)
srvrobj.serve_forever() # run as perpetual demon
请大家给我指点一下
|
|
|
[Original]
[Print]
[Top]
|
|
[Original]
[Print]
[Top]
|
第一种方式没试过。
第二种方式其实已经是编程了,如果你要在你的应用中实现一个相似的功能可以这样做。现在有一些例子,我记得有一个叫roundup的bug跟踪系统,就是采用这种方式,但具体细节是否一样我就不太清楚了,你有兴趣可以去pythonpi去看一看。python.org中的package index目录
还有就是在apache中配置,在我以前的python主页中我写了一篇文章,你可以去看一下。
http://pyrecord.freezope.org/articles/doc2001030901/show
对了,现在还有许多使用python做的web应用的框架,你有兴趣可以看一看,在google上查一下:
cherrypy, snakelets, quixote, webware, twisted 还有不少我不知道了。
|
|
|
----
|
|
[Original]
[Print]
[Top]
|
|
|