为什么我必须重新启动Django的fastcgi进程? [英] Why must I restart fastcgi process for Django?

查看:171
本文介绍了为什么我必须重新启动Django的fastcgi进程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

Django,Nginx,FastCGI缓存问题,当我更改代码

目前我使用Nginx + fastcgi来运行Django应用程序。在Web应用程序中更改Python文件的源代码后,我总是从浏览器中看到旧版本的应用程序。似乎它不包括我的更改。只有重新启动Django的fastcgi进程后,我的更改才会生效。有没有办法使我的更改立即生效,而不重新启动任何进程? (我在Windows中运行Nginx和Python进行调试。)

Currently I use Nginx + fastcgi to run Django applications. After I change the source code of a Python file in a web application, I always see the old version of application from browser. It seems that it doesn't include my changes. Only after I restart the fastcgi process of Django, my changes take effect. Is there a way to make my changes take effect immediately without restart any processes? (I run Nginx and Python in Windows for debugging.)

推荐答案

重新启动后,新的更改不会反映,因为您的代码是服务器启动时加载到内存中。 django开发环境不会受到影响的唯一原因是它在检测到更改时不断观察文件系统的更改和自动重新加载。

New changes aren't reflected until after restart because your code is loaded into memory when the server is started. The only reason why the django development environment doesn't suffer this is because it is constantly watching the filesystem for changes and auto-reloads when it detects a change.

有一些解决方案讨论了此处这里

There are some solutions discussed here and here.

这篇关于为什么我必须重新启动Django的fastcgi进程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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