简单的Python CGI 在linux平台实现
注意:路径是以当前路径为根目录 ,Python文件一般放在/cgi-bin/目录下
在linux命令行运行:python  -m  CGIHTTPServer  8000(端口号默认8000)
html文件名设为index.html 
测试:本机浏览器 输入 localhost:端口号

  #!/usr/bin/python
#python文件
import cgi show='''Content-Type:text/html\n
<html>
<head>
<title>llllll</title></head>
<body>
<p>hello world</p></body></html>
'''
print show
 <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>查询</title>
</head>
<body>
<form class="" action="cgi-bin/a.py" >
起点<input type="text" name="start" value="西二旗">
终点 <input type="text" name="end" value="中关村">
<input type="submit" name="name" value="提交">
</form>
</body>
</html>

python-cgi-demo的更多相关文章

  1. Apache运行python cgi程序

    Apache运行python cgi程序 环境 win10 x64 专业版 Apache2.4 python 2.7 Apache安装和配置 Apache服务器的安装请自行搜索.在Apache2.4中 ...

  2. Configuration python CGI in XAMPP in win-7

    1.After install XAMPP,we need add the path of the Mysql just find the path and add it to your sys-pa ...

  3. Python CGI编程和CGIHTTPServer

    Python2.7 的CGIHTTPServer 可以作为一个简单的HTTP服务器,能够调用cgi脚本 1 在任意目录下创建一个特殊的目录 cgi-bin ,用于存放自己写的脚本(.py或.cgi) ...

  4. Python CGI编程(转自易百)

    Python CGI编程 Python的CGI编程,公共网关接口或CGI,Web服务器和一个自定义的脚本之间交换信息是一组定义的标准.     什么是CGI ? 公共网关接口或CGI,Web服务器和一 ...

  5. Windows 配置 Apache Python CGI

    提示:安装Apache可参考 https://jingyan.baidu.com/article/0eb457e53c019f03f1a905c7.html 1.  打开URL: https://ww ...

  6. [Python]python CGI脚本在apache服务器上运行时出现“Premature end of script headers”错误

    在测试自己的python CGI脚本时, 当html网页中的表单form内容传送到服务器python脚本时, 总是出现Premature end of script headers错误, 网页显示是服 ...

  7. Configure Tomcat 7 to run Python CGI scripts in windows(Win7系统配置tomcat服务器,使用python进行cgi编程)

    Pre-installation requirements1. Java2. Python steps1. Download latest version of Tomcat (Tomcat 7) f ...

  8. python CGI编程-----简单的本地使用(1)

    本章节需要安装python开发工具,window平台安装地址:https://www.python.org/downloads/windows/,linux安装地址:https://www.pytho ...

  9. apache2.4 windows764 python cgi

    修改conf下的httpd.conf; 1:Listen和ServerName修改为相同的端口号,如8066 2:ScriptAlias就让他留在原位置,"${SRVROOT}/cgi-bi ...

  10. python CGI编程Apache配置

    1. 编辑http.conf,添加两行,路径可以自定义 <Directory "C:/AppServ/www/cgi-bin"> AllowOverride None ...

随机推荐

  1. 企业搜索引擎开发之连接器connector(二十八)

    通常一个SnapshotRepository仓库对象对应一个DocumentSnapshotRepositoryMonitor监视器对象,同时也对应一个快照存储器对象,它们的关联是通过监视器管理对象D ...

  2. HttpServletRequest介绍

    HttpServletRequest对象代表客户端的请求,当客户端通过HTTP协议访问服务器时,HTTP请求头中的所有信息都封装在这个对象中,通过这个对象提供的方法,可以获得客户端请求的所有信息. 二 ...

  3. cloudera search环境搭建搭建-solrcloud

    转载:http://blog.csdn.net/xiao_jun_0820/article/details/40539291 本文基于Cloudera Manager5.0.0,所有服务基于CDH5. ...

  4. C# 使用 COALESCE 表达式简化 Null 检查

    下面这个判断 null 的语句: a == null ? b: a 可以用 COALESCE 表达式,简化成: a ?? b

  5. maven多模块启动required a bean of type com.xxx.xxx.service that could not be found.

    Description: Field testService in com.xxx.xxx.api.controller.TestController required a bean of type ...

  6. django def validate_column和validate

    VIewDemo class RegUserSet(mixins.CreateModelMixin,viewsets.GenericViewSet): serializer_class = RegUs ...

  7. struts2 Convention插件好处及使用

    现在JAVA开发都流行SSH.而很大部分公司也使用了struts2进行开发..因为struts2提供了很多插件和标签方便使用..在之前开发过程中总发现使用了struts2会出现很多相应的配合文件.如果 ...

  8. mac下wordpress环境搭建

    mac下本来就有apache和php,只需要配置以下+安装mysql 1.Apache 预装目录在  /etc/apache2: 默认的网站目录在 /Library/WebServer/Documen ...

  9. WordPress插件Social Warfare<=3.5.2 无需登录RCE漏洞

    该漏洞只存在于Social Warfare插进的3.5.0.3.5.1和3.5.2版本中,其他版本不存在. 2019年3月21日插件作者紧急发布了3.5.3版本以修复高危的RCE漏洞,在<=3. ...

  10. Android 的一些中文文档

    https://blog.csdn.net/qq_36467463/article/details/77990089    //安卓mediaformat api详解 https://www.cnbl ...