Django代码更改时是否需要重新启动uWSGI? [英] Does uWSGI need to be restarted when Django code changes?

查看:403
本文介绍了Django代码更改时是否需要重新启动uWSGI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用在nginx和uWSGI下运行的Django Web应用程序.当我部署新的Django代码(例如settings.py)时,是否需要重新启动uWSGI?如果是这样,为什么?

I'm working on a Django webapp that's running under nginx and uWSGI. When I deploy new Django code (e.g., settings.py), do I need to restart uWSGI? If so, why?

背景:我有一个场景,其中更新了settings.py和一些其他代码并进行了部署.在重新启动uWSGI之前,我没有看到webapp行为的变化.

Background: I had a scenario where I updated settings.py and some other code and deployed it. I did not see the changes in the webapp behavior until I restarted uWSGI.

推荐答案

是的,您需要重新启动uWSGI进程.

Yes, you need to restart the uWSGI process.

Python将已编译的代码保留在内存中,因此在进程重新启动之前不会重新读取它. django开发服务器(manage.py runserver)主动监视文件中的更改,但是默认情况下,其他服务器不会发生这种情况.如果要在uWSGI中启用自动重新加载,请 touch-reload py-auto-reload uWSGI参数可能会有所帮助.

Python keeps the compiled code in memory so it won't get re-read until the process restarts. The django development server (manage.py runserver) actively monitors files for changes, but that won't happen by default with other servers. If you want to enable automatic reloading in uWSGI, the touch-reload and py-auto-reload uWSGI arguments might help.

这篇关于Django代码更改时是否需要重新启动uWSGI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆