python web.py

使用web.py能快速启动一个web服务。
# -*- coding: utf-8 -*-
import web

urls = (    
    '/(.*)', 'hello')

class hello:    

    def GET(self, name):        
	print name
	print web.ctx.env
	return "hello"

    def POST(self,name):
	print name
	print web.ctx.env.get("HTTP_USER_AGENT")
        print web.ctx.env	
	return "hello"
app = web.application(urls, globals())
application = app.wsgifunc()

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

猜你喜欢

转载自san-yun.iteye.com/blog/1612461