I have a html file which references static object like this
>
I think a better way to do this would be:
import flask
# ...
@app.route('/img/')
def legacy_images(fname):
return flask.redirect(flask.url_for('static', filename='img/' + fname), code=301)
Instead of sending the files on two different locations, this would do a permanent redirect to the proper URL. As others have said, it's also a good idea to serve static files directly with nginx or Apache.