安装flask:
pip install flask
第一个Flask页面hello.py:
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "<h1>Hello, World!</h1>"
if __name__ == '__main__':
app.run(debug=True)
运行web应用:
python hello.py
pip install flask
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return "<h1>Hello, World!</h1>"
if __name__ == '__main__':
app.run(debug=True)
python hello.py