[mod_python] mod_python not very smart about EGG_CACHE path

Graham Dumpleton graham.dumpleton at gmail.com
Sat Jan 24 09:18:17 EST 2009


2009/1/24 Joshua Kugler <joshua at joshuakugler.com>:
> So, today I discovered a little quirk in mod_python.  We had been explicitly
> setting the PYTHON_EGG_CACHE path during app startup, but I discovered that
> if it was not defined, it would use ~/.python-eggs.  GREAT!  One less
> config setting to maintain, so I took the code out.  After restarting
> Apache, I discovered (via error messages) that the cache path was set
> to /root/.python_eggs, even though the web server is running as 'apache'
>
> So, from what I can tell, the first Apache instance starts up, it's running
> as root, and sets PYTHON_EGG_CACHE to /root/.python-eggs.  The children
> start up, inherit this setting, but are now running as apache, so can't
> write to this directory.  Is there a way to get the children
> to "reinitialize" this setting so they write to the correct egg cache
> directory?

You are wrong. The mod_python package does not set PYTHON_EGG_CACHE to
anything. The value of it is being calculated by the Python module
which handles unpacking eggs, the first time it is required. The way
that it calculates it is to use value of $HOME. That environment
variable will be set to the value for root as that is what Apache was
started as.

Graham


More information about the Mod_python mailing list