1
我想从一个GET请求在烧瓶中使用这个答案为指导How to return images in flask response?为什么不能找到这个文件?
我有这样的代码在我的根目录下运行(关闭龙卷风服务器)返回一个jpg文件:
@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')
我有一个文件位于rootdirectory/static/images/123_Octavia_St.jpg
我收到此错误:
IOError: [Errno 2] No such file or directory: '/static/images/123_Octavia_St.jpg'
这里有路径:
$ pwd
pathto/rootdirectory/static/images
$ ls
123_Octavia_St.jpg