ExtractionError: Can't extract file(s) to egg cache The following error occurred while trying to extract file(s) to the

(from: http://docs.turbogears.org/1.0/mod_python  )


Setting the Egg Cache Directory

 

If you try to start apache right now you will receive an error like this one:

 


ExtractionError: Can
't extract file(s) to egg cache

The following error occurred
while trying to extract file(s) to the
Python egg cache:

[Errno
13] Permission denied: '/var/www/.python-eggs'

The Python egg cache directory
is currently set to:

/var/www/.python-eggs

Perhaps your account does
not have write access to this directory?
You can change the cache directory by setting the PYTHON_EGG_CACHE
environment variable to point to an accessible directory.

 

The problem comes from the fact thatmod_python needs to unzip the required eggs before your application canuse them, but for this the user under which apache runs needs to havewrite access to the specified directory.

 

There are diverse solutions to solve this problem.

  1. The first would be to give write access to the apache user to this /var/www/.python-eggs directory but this REALLY is not a good idea.
  2. The second way is to install all eggs unzipped to avoid the need to have a directory writable by apache.
  3. The third way is to specify before running apache were the apache user should unzip the eggs.

We won't talk about the first solution because it is NOT an option in a production environment.

 

The second option to install all TurboGears dependency by specifying that you want them unzipped can be realised doing so:

easy_install -UZ kid

tomake sure that kid is installed unzipped intead of inside a zipped egg.Then repeat the operation for each egg that you see in the<Python_Root>/site-packages directory that is used by TurboGears.

The third option is a bit different since you will set an environment variable to be picked up by apache:

mkdir -p /tmp/turbogears-eggcache 2>&1 >/dev/null
export PYTHON_EGG_CACHE="/tmp/turbogears-eggcache"
apachectl start

it is your responsibility to correctly secure this /tmp/turbogears-eggcache directory to avoid any security holes.


I have seen informations about using a PythonOption to set the PYTHON_EGG_CACHEbut I have never been able to make it work. If someone succeeds inusing a PythonOption directive inside the apache.conf file to set thisvariable I'll be delighted to hear about it.

 

posted on 2010-04-12 17:46  EyesCode  阅读(966)  评论(0)    收藏  举报

导航