views:

136

answers:

1

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.

Sometimes it works right away, but sometimes not...but restarting Apache definitely always catches it up. 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?

+2  A: 

This is the expected behavior of 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.

  2. Set PythonAutoReload to be On
    http://www.modpython.org/live/mod%5Fpython-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.

Arie Skliarouk