Python从入门到精通21.2.2节疑问
发表在Python图书答疑
2019-11-14
悬赏:2 学分
《Python从入门到项目实践》第22章 Flask Web框架的使用
是否精华
是
否
版块置顶:
是
否
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello World!'
@app.route('/user/<username>')
def show_user_profile(username):
# 显示该用户名的用户信息
return 'User %s' % username
@app.route('/post/<int:post_id>')
def show_post(post_id):
# 根据ID显示文章,ID是整型数据
return 'Post %d' % post_id
if __name__ == '__main__':
app.run(debug=True)
上述代码运行后出现以下显示:
* Environment: production
WARNING: This is a development server. Do not use it in a production deployment.
Use a production WSGI server instead.
* Debug mode: on
* Restarting with stat
An exception has occurred, use %tb to see the full traceback.
该怎么办?敬请老师赐教!不胜感激!
购物车
发表新帖
立即签到







