Django,Nginx,FastCGI缓存问题时我更改代码 [英] Django, Nginx, FastCGI caching problem when I change code

查看:113
本文介绍了Django,Nginx,FastCGI缓存问题时我更改代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经在我的一台服务器上安装了Django,Nginx和FastCGI。这是我的开发服务器,我在缓存时遇到困难。每次当我进行更改时,我必须重新启动整个服务器才能看到实际的更改。重新启动Nginx进程没有帮助eithter。



所以可能是Django和/或FastCGI进行缓存。我还查看了settings.py,Django上没有缓存设置。



当我更改页面代码时,最好的方法是确保缓存自动重置?你的帮助是非常感激的。

解决方案

如果不是 manage.py runserver 我们在说,你必须重新设置你的服务器才能看到代码的更改,把python和你的代码重新加载到内存中。



只有django devlopment服务器可以检测到您的更改和重新启动。



如果您说要重新启动机器来更新代码,那么您应该看看如何重新启动您的fastcgi进程。 p>

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

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



最好的方法?我在我的本地机器上开发,所以对我来说,部署脚本将确保我从版本控制和重新启动获得最新的更新。否则,我只需键入 arestart (一只手可以指定的bash别名)。


I've installed Django, Nginx and FastCGI on one my servers. 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.

So it might be Django and/or FastCGI doing the caching. I also looked at the settings.py and there is no caching set on 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.

Only the django devlopment server can detect changes and re-boot for you.

If you are saying you have to reboot the machine to update code, then you should look at how to restart your fastcgi process.

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

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).

这篇关于Django,Nginx,FastCGI缓存问题时我更改代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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