概述
例子如下:
from flask import Flask
app = Flask (__name__)
@app.route('/client/<path:path>')
def send_static(path):
""" serves all files from ./client/ to ``/client/<path:path>``
:param path: path from api call
"""
print("path=",path)
return "hello World"
if __name__ == '__main__':
app.run(debug=True)
运行:
python test.py
浏览器访问:
http://127.0.0.1:5000/client/test
终端会输出:
path= test
最后
以上就是大胆铅笔为你收集整理的"path:path"在路由中的使用的全部内容,希望文章能够帮你解决"path:path"在路由中的使用所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复