flask(python)
by 伍雪颖
安装flask:
$ easy_install flask
hello.py:
from flask
import Flask
app = Flask(__name__)
@app.route(‘/‘)
def hello():
return
"Hello world"
if __name__ ==
"__main__":
app.run()
运行:
?
flask
git:(master)
?
python
hello.py
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
127.0.0.1 - - [09/Feb/2015 15:21:07] "GET / HTTP/1.1" 200 -
127.0.0.1 - - [09/Feb/2015 15:21:07] "GET /favicon.ico HTTP/1.1" 404 -
效果:
时间: 2024-10-13 07:30:59