0
我做了一个小型服务器与烧瓶上传文件(然后做他们的东西)。上传是通过和发送文件的HTML表单:服务器无法上传与gunicorn大文件
<form action="/upload" method="POST" enctype="multipart/form-data">
<input type="file" name="file">
<input type="submit">
</form>
在服务器端,我做到以下几点:
@app.route('/upload', methods=['POST'])
def upload():
if 'file' in request.files:
f = request.files['file']
file_path = os.path.join(app.config['UPLOAD_FOLDER'], werkzeug.secure_filename(f.filename))
f.save(file_path)
return 'File is being uploaded'
它工作正常的小文件,但对大文件,它失败。问题是,如果我手动运行脚本而不是通过gunicorn python main.py
我可以上传我以前不能使用的文件。我以为我需要改变gunicorn的最大尺寸,但无法找到如何去做。
我也想过使用一个流,然后写块,但我再也找不到如何访问与烧瓶流。
感谢您的帮助
以什么方式? – pvg