当我更改代码时,Django、Nginx、FastCGI 缓存问题
我已经在我的一台服务器上安装了 Django、Nginx 和 FastCGI。这是我的开发服务器,我在缓存方面遇到了非常困难的时期。每次进行更改时,我都必须重新启动整个服务器才能看到实际的更改。重新启动 Nginx 进程也没有帮助。
所以可能是 Django 和/或 FastCGI 进行缓存。我还查看了settings.py,Django上没有设置缓存。
确保更改页面代码时缓存自动重置的最佳方法是什么?非常感谢您的帮助。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它不是我们正在讨论的
manage.py runserver
,您必须重置服务器才能看到代码更改,从而将 python 和代码重新加载到内存中。只有 django 开发服务器可以检测更改并为您重新启动。
如果您说必须重新启动机器才能更新代码,那么您应该了解如何重新启动 fastcgi 进程。
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
至于最好的方法?我在本地计算机上进行开发,因此对我来说,部署脚本将确保我从版本控制和重新启动中获得最新更新。否则,我只需输入
arestart
(可单手输入的 bash 别名)。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).