当前位置:首页 > 在线留言 >

[Python 2.7] Hello World CGI HTTP Server

[Python 2.7] Hello World CGI HTTP Server


# CGI HTTP server
## Getting Started
Python 2.x is preferred to this simple demo. I'm using Python 2.7 over windows.
* https://docs.python.org/2.7/library/cgihttpserver.html * https://docs.python.org/2.7/library/cgi.html
## Starting a CGIHTTPServer
$ python -m CGIHTTPServer 8000 Serving HTTP on 0.0.0.0 port 8000 ...

## CGI Script, Hello World
$ mkdir cgi-bin/
$ vim cgi-bin/index.py print "Content-Type: text/html" # HTML is following print # blank line, end of headers
print "CGI script output" print "This is my first CGI script" print "Hello, world!"
## Access
Browser the following link and a web page will return.
http://localhost:8000/cgi-bin/index.py

This is my first CGI script Hello, world!




,专题

企业建站2800元起,携手武汉肥猫科技,做一个有见地的颜值派!更多优惠请戳:天门网站制作 http://tianmen.666rj.com

上一篇:比较三个数大小

下一篇:最后一页