python 后端给前端提供一个可以打开的url 图片链接
from flask import Flask, send_file
import os
app = Flask(__name__)
@app.route('/image/<path:filename>')
def send_image(filename):
# 假设图片存储在static文件夹下
return send_file('/image/'+ filename)
if __name__ == "__main__":
app.run(debug=True,port=5001,host='0.0.0.0')
在服务器/image下面保存1.png
chrome访问 http:/ipv4:5001/image/1.png 即可.