【发布时间】:2019-07-21 11:28:13
【问题描述】:
我正在尝试使用 gunicorn、nginx、flask 和 MySQL 上传一个简单的 .png 图像,但是上传一个 5 mb 的图像需要 10 秒?我正在运行一个 ec2 微实例,但上传时 CPU 使用率低于 30%。
我的烧瓶代码 # 帖子名称为每张图片使用唯一 ID post_name = str(postID) + '_post.png' 目的地 = os.path.join(target, post_name)
c.execute('UPDATE posts set filename=%s, filetype="picture"
where postID=%s',
(destination, postID))
file.save(destination)
我的 nginx 配置
location / {
include proxy_params;
client_max_body_size 250M;
proxy_pass http://127.0.0.1:8000;
root /home/ubuntu ;
client_body_buffer_size 8M;
}
【问题讨论】: