简体   繁体   English

我改变代码时Django,Nginx,FastCGI缓存问题

[英]Django, Nginx, FastCGI caching problem when I change code

I've installed Django, Nginx and FastCGI on one my servers. 我在我的服务器上安装了Django,Nginx和FastCGI。 This is my development server and I'm having a very difficult time with the caching. 这是我的开发服务器,我在使用缓存时非常困难。 Every time when I make a change I have to reboot the whole server to see the actual change. 每当我进行更改时,我必须重新启动整个服务器以查看实际更改。 Rebooting Nginx process didn't help eithter. 重新启动Nginx进程没有帮助eithter。

So it might be Django and/or FastCGI doing the caching. 所以它可能是Django和/或FastCGI进行缓存。 I also looked at the settings.py and there is no caching set on Django. 我还查看了settings.py,并且Django上没有缓存设置。

What's the best way to make sure when I change the page code the caching gets reset automatically? 什么是确保何时更改页面代码时自动重置缓存的最佳方法? Your help is greatly appreciated. 非常感谢您的帮助。

If it's not manage.py runserver we're talking about, you have to reset your server to see code changes to reload python and your code into memory. 如果它不是我们讨论的manage.py runserver ,你必须重置你的服务器以查看代码更改以将python和你的代码重新加载到内存中。

Only the django devlopment server can detect changes and re-boot for you. 只有django开发服务器可以检测到更改并为您重新启动。

If you are saying you have to reboot the machine to update code, then you should look at how to restart your fastcgi process. 如果您说您必须重新启动计算机以更新代码,那么您应该查看如何重新启动fastcgi进程。

http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#stopping-the-fastcgi-daemon http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#stopping-the-fastcgi-daemon
http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#restarting-the-spawned-server http://docs.djangoproject.com/en/dev/howto/deployment/fastcgi/#restarting-the-spawned-server

As for the best way? 至于最好的方式? I develop on my local machine so for me a deployment script would ensure I get the latest update from version control and a reboot. 我在我的本地机器上开发,所以对我来说,部署脚本将确保我从版本控制和重新启动获得最新更新。 Otherwise I just type arestart (a one hand typable bash alias). 否则我只输入arestart (单手arestart bash别名)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM