install webpy

http://webpy.org/install.zh-cn
http://webpy.org/install_macosx


不使用macports,换用Homebrew
http://liang.eu/mac/forgot-macports-now-we-have-homebrew

一令安装Homebrew
https://github.com/mxcl/homebrew/wiki/Installation
//Homebrew的使用方法:
$ brew install postgresql



下载webpy
http://webpy.org/static/

import web

urls = (
    '/(.*)', 'hello'
)
app = web.application(urls, globals())

class hello:        
    def GET(self, name):
        if not name: 
            name = 'World'
        return 'Hello, ' + name + '!'

if __name__ == "__main__":
    app.run()


启动脚本
python code.py
测试:
http://localhost:8080/

你可能感兴趣的:(Install)