利用web.py快速搭建网页helloworld

 

访问web.py官网 http://webpy.org/

SGHBNNIT]}54B}0K8@}GDTW

根据网站步骤,利用 pip install web.py

若没有 PIP

则先安装pip

运行 

sudo apt-get install python-pip

image

网站安装python 2 ,运行python 3 则需要

pip install web.py==0.40-dev1

编写 myweb.py运行脚本
 
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()
 
 

猜你喜欢

转载自www.cnblogs.com/xiumusheng/p/10328932.html