Django目录权限配置问题

时间:2011-05-03 21:35:23

标签: django permissions mod-wsgi

我在error.log中输入以下内容:

 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1]   [Errno 13] Permission denied:     '/Dropbox/project/www/mod_wsgi/egg-cache'
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] 
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] The Python egg cache directory is currently set to:
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] 
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1]   /Dropbox/project/www/mod_wsgi/egg-cache
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] 
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] Perhaps your account does not have write access to this directory?  You can
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] change the cache directory by setting the PYTHON_EGG_CACHE environment
 [Tue May 03 16:42:21 2011] [error] [client 127.0.0.1] variable to point to an accessible directory.

我应该如何设置它?

更新:

目前

权限:

drwxr-xr-x   4 petarpetrov  admin  136 Apr 30 13:38 mod_wsgi

此外,由于某种原因,用户和Apache的组合似乎都是_www

1 个答案:

答案 0 :(得分:2)

为了在目录中创建文件,用户Apache正在运行,因为需要具有写入权限。目前,Apache在_www组中以_www用户身份运行,而petarpetrov拥有该目录,并且是唯一允许写入该目录的用户。

为了允许_www写入该目录,您应该将拥有它的组更改为_www并更改目录权限:

chgrp _www /Dropbox/touchsofia/www/mod_wsgi/egg-cache
chmod g+w /Dropbox/touchsofia/www/mod_wsgi/egg-cache

这应该将组所有权更改为_www并允许该组写入该目录。根据进入该目录的内容,可能需要更多权限。