我有一个引用这样的静态对象的html文件
<img src="img/snacks.png">
<link href="css/bluestrap.css" rel="stylesheet">
Run Code Online (Sandbox Code Playgroud)
因此浏览器尝试调用此通道并且烧瓶无法执行此操作
http://127.0.0.1:5000/img/snacks.png
Run Code Online (Sandbox Code Playgroud)
跨多个文件有很多这样的引用,因此无法更改引用.我如何从FLASK提供这些静态文件
我已将所有这些静态文件复制到'static'文件夹并尝试了这个
@app.route('/<path:filename>')
def send_file(filename):
return send_from_directory('/static', filename)
Run Code Online (Sandbox Code Playgroud)
但是这不起作用,有没有其他方法可以做到这一点?或者我做错了什么?