pycharm python @符号不能识别 NameError: name 'app' is not defined
解决办法:
缺少:app = Flask(__name__)
# 导入Flask类
from flask import Flask
# 实例化,可视为固定格式
app = Flask(__name__) # route()方法用于设定路由;类似spring路由配置
@app.route('/quark/callback/<int:sid>')
def hello_world(sid):
return 'Hello, World!' if __name__ == '__main__':
# app.run(host, port, debug, options)
# 默认值:host=127.0.0.1, port=5000, debug=false
app.run(host='0.0.0.0', port=38002, debug=True)