@app.route("/")
def index():
return "hello flask"
if name == 'main':
#运行本都服务器测试flask程序
print(app.url_map)
app.run(debug=True
为什么显示不了Map相应信息
你的 index 函数可以正常访问?代码最好贴全点,我的正常打印没毛病
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'hello'
if __name__ == '__main__':
print('url_map', app.url_map)
app.run(host='127.0.0.1', port=5002)
"""
...
('url_map', Map([<Rule '/' (HEAD, OPTIONS, GET) -> index>,
<Rule '/static/<filename>' (HEAD, OPTIONS, GET) -> static>]))
* Serving Flask app "app" (lazy loading)
...
"""