我正在尝试使用mod_wsgi设置Apache以在Red Hat盒子上运行Django,但我得到了可怕的“Permission denied:'/ home / pineg /。python-egggs'”egg cache extraction错误。< / p>
我做了它说的话,并把它作为第一行:
SetEnv PYTHON_EGG_CACHE /opt/tmp
/etc/httpd/conf/httpd.conf 中的
重新启动Apache:
>sudo /etc/init.d/httpd restart
但我仍然得到同样的错误(下面)。这几乎就像Apache忽略了我的SetEnv。
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] The following error occurred while trying to extract file(s) to the Python egg
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] cache:
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561]
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] [Errno 13] Permission denied: '/home/pineg/.python-eggs'
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561]
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] The Python egg cache directory is currently set to:
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561]
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] /home/pineg/.python-eggs
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561]
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] Perhaps your account does not have write access to this directory? You can
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Fri May 06 10:08:37 2011] [error] [client 10.101.11.561] variable to point to an accessible directory.
答案 0 :(得分:4)
此问题和解决方案在mod_wsgi文档中描述:
http://code.google.com/p/modwsgi/wiki/ApplicationIssues#Access_Rights_Of_Apache_User
答案 1 :(得分:2)
我现在对Apache-Django的具体细节一无所知,但总的来说
SetEnv PYTHON_EGG_CACHE /opt/tmp
没有设置环境变量,只会将其添加到environ
dict,application(environ, start_response)
中的index.wsgi
函数应该接受。
答案 2 :(得分:0)
哦,好吧,我告诉Python不要把它安装成一个愚蠢的蛋,而不是愚弄它:
>sudo python setup.py install --single-version-externally-managed --record=/opt/python/source/weird_egg_thing