uWSGI - Different Harakiri Timeout for Django Admi

2019-02-09 20:52发布

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

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.

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

1条回答
老娘就宠你
2楼-- · 2019-02-09 21:44

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
查看更多
登录 后发表回答