Virtual Env activate_this.py权限被拒绝

时间:2014-12-31 22:13:04

标签: python django apache virtualenv wsgi

运行网站时,我得到代码500,在底部的apache文件中输出。

我已经更改了让appache用户拥有这些文件的权限,甚至还提交了chmod 777位于virtualenv环境中的所有文件。

我无法理解它。我发现了几点文件并已经尝试过他们所做的事情。改变权限没有成功。

显示apache的目录拥有该文件

[user@host bin]$ pwd
/Envs/AppSiteEnv/bin
[user@bhost bin]$ ls -l
total 60
-rwxrwxrwx. 1 apache domain users 2202 Dec 31 15:50 activate
-rwxrwxrwx. 1 apache domain users 1258 Dec 31 15:50 activate.csh
-rwxrwxrwx. 1 apache domain users 2471 Dec 31 15:50 activate.fish
-rwxrwxrwx. 1 apache domain users 1129 Dec 31 15:50 activate_this.py
-rwxrwxrwx. 1 apache domain users  282 Dec 31 15:51 django-admin
-rwxrwxrwx. 1 apache domain users  141 Dec 31 15:51 django-admin.py
-rwxrwxrwx. 1 apache domain users  310 Dec 31 15:51 django-admin.pyc
-rwxrwxrwx. 1 apache domain users  249 Dec 31 15:50 easy_install
-rwxrwxrwx. 1 apache domain users  249 Dec 31 15:50 easy_install-2.7
-rwxrwxrwx. 1 apache domain users  221 Dec 31 15:50 pip
-rwxrwxrwx. 1 apache domain users  221 Dec 31 15:50 pip2
-rwxrwxrwx. 1 apache domain users  221 Dec 31 15:50 pip2.7
-rwxrwxrwx. 1 apache domain users 9832 Dec 31 15:50 python
lrwxrwxrwx. 1 apache domain users    6 Dec 31 15:50 python2 -> python
lrwxrwxrwx. 1 apache domain users    6 Dec 31 15:50 python2.7 -> python
(AppSiteEnv)[user@host bin]$ 

wsgi.py:

import os
import sys
import site

site.addsitedir('/Envs/AppSiteEnv/lib/python2.7/site-packages')

path = '/var/www/Appsite'
if path not in sys.path:
    sys.path.append(path)

os.environ.setdefault("DJANGO_SETTINGS_MODULE", "Appsite.settings")

activate_env=os.path.expanduser('/Envs/AppSiteEnv/bin/activate_this.py')
execfile(activate_env, dict(__file__=activate_env))

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

Apache日志:

[error] [client 10.x.x.x] Traceback (most recent call last):
[error] [client 10.x.x.x]   File "/var/www/Appsite/Appsite/wsgi.py", line 29, in <module>
[error] [client 10.x.x.x]     execfile(activate_env, dict(__file__=activate_env))
[Wed Dec 31 16:02:09 2014] [error] [client 10.x.x.x] IOError: [Errno 13] Permission denied: '/Envs/AppSiteEnv/bin/activate_this.py'

0 个答案:

没有答案