I am trying to return a jpg file from a get request in Flask using this answer as a guide How to return images in flask response?
I have this code running in my root directory (off a tornado server):
@app.route('/pic/<string:address>', methods= ["GET"])
def here(address=None):
return send_file(url_for('static', filename='images/123_Octavia_St.jpg'), mimetype='image/jpg')
I have the file located at rootdirectory/static/images/123_Octavia_St.jpg
I am getting this error:
IOError: [Errno 2] No such file or directory: '/static/images/123_Octavia_St.jpg'
Here are the paths:
$ pwd
pathto/rootdirectory/static/images
$ ls
123_Octavia_St.jpg