我使用Zappa(后面使用AWS和S3)托管了我的Flask Web应用程序。我的申请涉及上传和下载文件。当我尝试执行上述任一操作时,出现以下错误。
IOError:[Errno 30]只读文件系统
为什么S3阻止上传/下载以及如何将其更改为可读写?
您可以访问托管应用here
@app.route('/paper_upload',methods=['POST','GET'])
def paper_upload(): # Journal Upload
if request.method == 'POST' and 'file' in request.files:
filename = files.save(request.files['file'])
doc = Journal(title=request.form['Title'],user_email=session['email'],
domain=request.form['domain'],status="Submission received",filename=filename,date=datetime.datetime.utcnow())
doc.save()
flash('Journal Submitted')
return redirect(url_for('dashboard'))
@app.route('/download/<filename>',methods=['POST','GET'])
def download(filename):
return send_file(safe_join('app.config['UPLOADED_FILES_DEST']',filename),as_attachment=True)