本文介绍了uWSGI - Django管理员的不同Harakiri超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以设置uWSGI对于Django管理页面的harakiri超时是不同的?

Is it possible to set uWSGI's harakiri timeout to be different for Django admin pages?

我有一个需要上传大文件的网站,可能需要20或30秒钟以上,但是我希望全球harakiri超时更像15秒,因为我如何将数据发回用户。

I have a site which requires large files to be uploaded, which can take more than 20 or 30 seconds, but I want the global harakiri timeout to be more like 15s because of how I'm sending data back to the user.

这是uWSGI支持的吗?有没有办法从Django项目中排除这个问题?

Is this supported by uWSGI? Is there any way I can indidate this from within my Django project?

推荐答案

确保您的实例已启用内部路由如果您没有启动日志,那么可以在启动日志中打印出可怕的警告),并将harakiri管理员委托给它(因此删除harakiri选项):

Be sure your instance has internal routing enabled (a pretty scary warning is printed on startup logs if you do not have it) and delegates harakiri management to it (so remove the harakiri options):

[uwsgi]
; set harakiri to 30 seconds for /admin
route = ^/admin harakiri:30
; stop the routing chain for /admin
route = ^/admin last:
; set harakiri to 15 for all the other uris
route-run = harakiri:15

这篇关于uWSGI - Django管理员的不同Harakiri超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-22 22:43