简单的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. 树莓派3下安装TL-WN722N无线网卡驱动

    最近在搞树莓派,我的是国产的树莓派3卡片电脑,想整成一个无线加有线的路由器(树莓派3.TL-WN722N无线网卡.集线器)或者是搭个web认证的WIFI钓鱼热点玩玩. 一开始就遇到问题了,连无线网卡的 ...

  2. 使用 log4j 打印日志

    开发阶段:发现程序的问题,排错 产品阶段:记录程序运行的状况 Maven中配置依赖 通过配置文件输出日志的格式,输送的位置等 一.入门实例 1.新建一个JAva工程,导入包log4j-1.2.17.j ...

  3. 二道Const,readonly 和 override, new的面试题

    1. Const 和 readonly ; ; ; ; static void Main(string[] args) { Console.WriteLine("aa:{0},bb:{1}, ...

  4. SQL Server创建表超出行最大限制解决方法

    问题的现象在创建表A的时候,出现“信息 511,级别 16,状态 1,第 5 行  无法创建大小为 的行,该值大于允许的最大值 8060.”的信息提示.很奇怪,网上查了一下,是因为要插入表的数据类型的 ...

  5. SSH小项目整合的简单记录

    第一步.导入sprint4.struts2和hibernate4的jar包 struts2的jar包 commons-fileupload-1.3.3.jar commons-io-2.5.jar c ...

  6. c#复习提纲

    c#零碎整理 注:本文中大部分图片来自老师的PPT,感谢邵老师!文中所有内容为自己按照PPT整理,欢迎指正! 标识符 标识符(类名.变量名.方法名.表空间名等) 大小写敏感 正则表达式  小括号(组合 ...

  7. NPOI 设置excel 边框

    https://blog.csdn.net/xxs77ch/article/details/50232343

  8. windows server 2008 站点系列--AD的站点建立与子网的管理(zhuanzai)

    本次课程将给大家介绍AD中站点和子网的功能.站点和子网之间的关联,以及相关的设置步骤. 应用背景介绍: contoso公司的总部在西安(Xian),陕南的汉中(Shannan)和陕北的榆林(Shanb ...

  9. StringBudiler源码简单解析

    StringBudiler源码 继承关系树 底层实现 默认容量() 特别的添加方法(append) 1.继承关系树 继承自AbstractStringBuilder与StringBuffer同族 2. ...

  10. 【OCP题库】最新CUUG OCP 12c 071考试题库(66题)

    66.(22-19)choose two Examine the structure proposed for the TRANSACTIONS table: Which two statements ...