I have a html file which references static object like this
<img src="img/snacks.png">
<link href="css/bluestrap.css" rel="stylesheet">
Hence the browser tries to call this via and flask fails to do so
http://127.0.0.1:5000/img/snacks.png
There are lots of such references across multiple files hence changing the references is not possible. How do i serve these static files from FLASK
I have copied all these static files to the 'static' folder and tried this
@app.route('/<path:filename>')
def send_file(filename):
return send_from_directory('/static', filename)
However this does not work, Is there any other way to do this ? or what am i doing wrong ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…