+-

我在使用FastCGI的nginx上使用 django,我遇到了urls.py的问题.根据 this question,django缓存url.py文件,我就像上面问题的作者一样 – 无法修改我的URL定义.
我的问题是 – 有没有办法在没有服务器重启的情况下清除django / nginx / fcgi中的url缓存(这无论如何都没有帮助)?
最佳答案
这不仅仅是一个urls.py,它是运行wsgi或fastcgi应用程序的正常工作流程.该模块位于内存中,在您告诉服务器它已更改之前,它不会从磁盘重新加载.
按照Django’s FastCGI docs:
If you change any Python code on your site, you’ll need to tell FastCGI the code has changed. But there’s no need to restart Apache in this case. Rather, just reupload mysite.fcgi, or edit the file, so that the timestamp on the file will change. When Apache sees the file has been updated, it will restart your Django application for you.
If you have access to a command shell on a Unix system, you can accomplish this easily by using the touch command:
touch mysite.fcgi
对于开发,在大多数情况下,您可以使用django development server,它会监视代码更改并在发现更改时重新启动.
点击查看更多相关文章
转载注明原文:python – 刷新django中的urls.py缓存 - 乐贴网