使用python写一个web
2014-08-29 23:02
232 查看
先编写
再编写一个
View Code
hello.py,实现Web应用程序的WSGI处理函数:
# hello.py def application(environ, start_response): start_response('200 OK', [('Content-Type', 'text/html')]) return '<h1>Hello, %s!</h1>' % (environ['PATH_INFO'][1:] or 'web')
再编写一个
server.py,负责启动WSGI服务器,加载
application()函数:
from wsgiref.simple_server import make_server from hello import application httpd = make_server('', 8000, application) print "Serving HTTP on port 8000..." httpd.serve_forever()
View Code
相关文章推荐
- 使用Python的Tornado框架实现一个Web端图书展示页面
- 使用Python写一个WEB服务器
- 使用Python的Tornado框架实现一个Web端图书展示页面
- Python(27)使用python的http,cgi模块实现一个简单的web服务
- 使用Python写一个WEB服务器(额外)
- python 之 使用web.py实现一个简单的增删改查应用
- 使用python写一个监控mysql的脚本,在zabbix web上加上模板
- 使用Python写一个WEB服务器(额外(续))
- 使用Python起一个web服务
- IronPython for ASP.NET:使用IronPython创建一个简单的Web页面
- Python web框架Django学习(1)——在win7 64bit下配置开发环境Django:一个可以使Web开发工作愉快并且高效的Web开发框架。 使用Django,使你能够以最小的代价构建和
- 【LINUX】——linux如何使用Python创建一个web服务
- 使用Python写一个WEB服务器(续)
- 使用python为Java项目开发一个预编译脚本
- [翻译]使用少于500行的代码创建一个webserver
- FCKeditor 一个开源的web页面文本编辑工具,在vs 2005中的使用方法
- 作了一个介绍和如何使用web-config文的报告
- 使用myeclipse创建一个上传文件的web工程
- 使用os3grid做一个基于Web和Ajax的工资表录入界面
- 如何使用一个不错的图表组件WebChart(免费)