简体   繁体   English

mod_python解释器的缓存未在脚本更改时重置?

[英]mod_python interpreter's cache not getting reset on script change?

I use mod_python.publisher to run Python code and discovered a problem: When I update a script the update doesn't always work right away and I get the same error I fixed with the update until I restart Apache. 我使用mod_python.publisher运行Python代码并发现了一个问题:当我更新脚本时,更新并不总是立即生效,并且在重新启动Apache之前,我得到了与更新相同的错误。

Sometimes it works right away, but sometimes not...but restarting Apache definitely always catches it up. 有时它可以立即生效,但有时却无法...但是重新启动Apache肯定总能赶上它。 It's a pain to have to restart Apache so much and I would think there is a better way to do this -- but what is it? 不得不重新启动Apache真是太痛苦了,我认为有更好的方法可以做到这一点-但这是什么?

This is the expected behavior of mod_python. 这是mod_python的预期行为。 Your code is loaded into memory and won't be refreshed until the server is restarted. 您的代码已加载到内存中,直到服务器重新启动后才会刷新。

You have two options: 您有两种选择:

  1. Set MaxRequestsPerChild 1 in your httpd.conf file to force Apache to reload everything for each request. 在httpd.conf文件中设置MaxRequestsPerChild 1以强制Apache为每个请求重新加载所有内容。

  2. Set PythonAutoReload to be On 将PythonAutoReload设置为On
    http://www.modpython.org/live/mod_python-3.2.5b/doc-html/dir-other-par.html http://www.modpython.org/live/mod_python-3.2.5b/doc-html/dir-other-par.html

But don't do that on a production server, as it will slow down the initialization time. 但是不要在生产服务器上这样做,因为这会减慢初始化时间。

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

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