0

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?

unwind
  • 391,730
  • 64
  • 469
  • 606
Arie Skliarouk
  • 423
  • 2
  • 11
  • 2
    Consider switching to mod_wsgi where you can more easily control this with the unix `touch` command. – S.Lott Sep 23 '09 at 11:44

1 Answers1

3

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

Arie Skliarouk
  • 423
  • 2
  • 11
  • It's not working on my hosting w/o root access. Too bad every hotfix has to wait a lot of time to go live. – Ctrl-C Aug 05 '12 at 12:36