问题
I am trying to setup Django to use MySQL. I am getting the following error when I type in localhost/mysite
ExtractionError at /
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: '/Library/WebServer/.python-eggs'
The Python egg cache directory is currently set to:
/Library/WebServer/.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.
From the error message I know that I have to change the PYTHON_EGG_CACHE
environment variable to point to a directory that Apache can access. I tried adding the following to httpd.conf
SetEnv PYTHON_EGG_CACHE /var/www
<Directory /var/www>
Order deny,allow
Allow from all
</Directory>
and also just SetEnv PYTHON_EGG_CACHE /var/www
to bashrc
, but nothing seems to resolve the problem. Any suggestions on what I might be doing wrong?
Note: www
is a folder that I created
回答1:
Also might try to set the egg cache directory in the wsgi script,
import os
os.environ['PYTHON_EGG_CACHE'] = '/usr/local/pylons/python-eggs'
as can be found from here http://code.google.com/p/modwsgi/wiki/ApplicationIssues
回答2:
Based on your previous question, you're using WSGI. You want WSGIPythonEggs or the python-eggs
option for WSGIDaemonProcess.
来源:https://stackoverflow.com/questions/9107016/how-to-setup-up-python-egg-cache-environment-variable-on-mac