Differences between revisions 1 and 2
Revision 1 as of 2009-09-30 06:23:08
Size: 761
Comment:
Revision 2 as of 2009-12-25 07:15:10
Size: 761
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

题目要求

写一个Hello,world程序,带有环境安装说明

框架说明

web.py (http://webpy.org)

安装

环境要求

  • python 2.5, python 2.6
  • setuptools 0.6c9

安装

easy_install web.py

步骤

在命令行下操作

1. 创建Project1项目

mkdir project1

2. 创建Hello App,编辑 project1/hello.py

   1 import web
   2 
   3 urls = ('/', 'hello')
   4 
   5 class hello:
   6     def GET(self):
   7         return "Hello World"
   8 
   9 app = web.application(urls, globals())
  10 
  11 if __name__ == '__main__':
  12     app.run()    

3. 结束

测试

cd project1
python hello.py

访问 http://localhost:8080 即可。

WebPyHelloWorld (last edited 2009-12-25 07:15:10 by localhost)