当配置上传目录是
UPLOAD_FOLDER = '/app/uploads'
执行
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
没报错
再执行
@app.route('/uploads/')
def uploaded_file(filename):
return send_from_directory(app.config['UPLOAD_FOLDER'],
filename)
在浏览器上面可以看到图片,但是找不到上传的目录
当配置上传目录是
UPLOAD_FOLDER = 'app/uploads'
执行
file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
没报错
再执行
@app.route('/uploads/')
def uploaded_file(filename):
return send_from_directory(app.config['UPLOAD_FOLDER'],
filename)
在浏览器上面开不到图片,但是找到上传目录
关键在于 上传目录的'/'
怎样才能上传了之后在浏览器看到图片,也找到对应的上传目录呢
波斯汪
相关分类