在MAC/LINUX環境下,執行vi hello.py命令,並輸入如下代碼
python
import web import sys urls = ("/Service/hello","hello") app = web.application(urls,globals()) class hello: def GET(self): return 'Hello,world!'; if __name__=="__main__": app.run()
執行python hello.py 8080出現 web
http://0.0.0.0:8080/app
而後訪問"http://localhost:8080/Service/Match"地址,返回結果爲url
Hello,world!
終端的結果爲:spa
127.0.0.1:49400 - - [15/Aug/2014 17:57:26] "HTTP/1.1 GET /Service/Match" - 200 Ocode