nginx+uwsgi+django报错:[Errno 13] Permission denied: ‘/root/.python-eggs’

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: '/root/.python-eggs'
 

实际上也就是:安装的MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg需要解压到/root/.python-eggs目录,而Apache访问的用户并没有该目录的write权限。

一个fix方法是在修改你的django.wsgi文件,添加PYTHON_EGG_CACHE的设置,先

mkdir  /tmp/.python-eggs
uwsgi.py 加上:

if sys.platform <> "win32":
              os.environ['PYTHON_EGG_CACHE'] = '/tmp/.python-eggs'

另一个简单的fix的方法就是将MySQL解压成目录结构:

$ cd /usr/lib/python2.6/site-packages/ (or wherever your site-packages are)
$ file MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg
$ unzip -t MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg
$ mv MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg foo.zip
$ mkdir MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg
$ cd MySQL_python-1.2.3c1-py2.6-linux-x86_64.egg/
$ unzip ../foo.zip
$ rm ../foo.zip




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值