Python web.py实现web server

前端之家收集整理的这篇文章主要介绍了Python web.py实现web server前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

安装web.py

easy_install web.py

测试

import web

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

class hello:
def GET(self,name):
if not name:
name = 'World'

允许跨域

        web.header("Access-Control-Allow-Origin","*")
    return '{"key":"value"}'

if name == "main":
app.run()

猜你在找的程序笔记相关文章