更改文件后重新启动Gunicorn

更改文件后重新启动Gunicorn

本文介绍了更改文件后重新启动Gunicorn/Nginx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Django开发一个Web应用程序,该应用程序托管在Gunicorn和Nginx上.每当我对代码进行更改时,运行"sudo服务nginx重新启动; sudo服务gunicorn重新启动"会带来一些不便.有什么方法可以使它们在进行更改时自动重新启动,或者进行更改以使更改显示出来而不必重新启动?

I'm working on developing a web app using Django, hosted on Gunicorn and Nginx. It's getting a bit inconvenient to run "sudo service nginx restart; sudo service gunicorn restart" every time I make a change to the code. Is there a way I can make them restart automatically whenever I make a change, or make it so the changes show up without having to restart?

推荐答案

您可以添加'--reload'参数,如gunicorn文档中所述.

You could add the '--reload' argument, as mentioned in the gunicorn documentation.

此设置用于开发.这将导致工人 应用程序代码更改时,重新启动.

This setting is intended for development. It will cause workers to be restarted whenever application code changes.

来源: http://docs.gunicorn.org/en/latest/settings. html

这篇关于更改文件后重新启动Gunicorn/Nginx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 05:50