nginx+uwsgi+django报错:[Errno 13] Permission denied: ‘/root/.python-eggs’
来源:互联网 发布:java专业培训机构 编辑:程序博客网 时间:2024/04/29 21:12
转自:http://blog.csdn.net/leiyonglin/article/details/7186660
- 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
关于django发布时发生的500错误
在完成所有配置,应用程序也已经初始化了(数据库),但是在访问的时候发生了500的错误,不得其解,权限什么的也重新分配了,但问题依旧,在查看日志的时候,发现了这样的错误:
mod_wsgi (pid=2939): Exception occurred processing WSGI script '/web/wsgi/mysite.wsgi'.
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] Traceback (most recent call last):
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/core/handlers/wsgi.py", line 241, in __call__
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] response = self.get_response(request)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/core/handlers/base.py", line 73, in get_response
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] response = middleware_method(request)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/contrib/sessions/middleware.py", line 10, in process_request
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] engine = import_module(settings.SESSION_ENGINE)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] __import__(name)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/contrib/sessions/backends/db.py", line 2, in <module>
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] from django.contrib.sessions.models import Session
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/contrib/sessions/models.py", line 4, in <module>
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] from django.db import models
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/db/__init__.py", line 41, in <module>
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] backend = load_backend(settings.DATABASE_ENGINE)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/db/__init__.py", line 17, in load_backend
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] return import_module('.base', 'django.db.backends.%s' % backend_name)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/utils/importlib.py", line 35, in import_module
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] __import__(name)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/django/db/backends/mysql/base.py", line 10, in <module>
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] import MySQLdb as Database
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "build/bdist.linux-i686/egg/MySQLdb/__init__.py", line 19, in <module>
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "build/bdist.linux-i686/egg/_mysql.py", line 7, in <module>
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "build/bdist.linux-i686/egg/_mysql.py", line 4, in __bootstrap__
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 800, in resource_filename
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] self, resource_name
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 1228, in get_resource_filename
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] self._extract_resource(manager, self._eager_to_zip(name))
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 1250, in _extract_resource
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] self.egg_name, self._parts(zip_path)
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 880, in get_cache_path
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] self.extraction_error()
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] File "/usr/local/python25/lib/python2.5/site-packages/setuptools-0.6c5-py2.5.egg/pkg_resources.py", line 846, in extraction_error
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] raise err
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] ExtractionError: Can't extract file(s) to egg cache
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172]
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] The following error occurred while trying to extract file(s) to the Python egg
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] cache:
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172]
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] [Errno 13] Permission denied: '/root/.python-eggs'
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172]
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] The Python egg cache directory is currently set to:
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172]
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] /root/.python-eggs
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172]
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] Perhaps your account does not have write access to this directory? You can
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] change the cache directory by setting the PYTHON_EGG_CACHE environment
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172] variable to point to an accessible directory.
[Sat Jan 23 13:49:40 2010] [error] [client 120.32.59.172]
这样的话意思是缓存没有权限写入,于是在mysite.wsgi里加了这么一句话,设置cache的路径,要保证该路径的文件夹权限是可写的。
os.environ['PYTHON_EGG_CACHE'] = '/tmp'
- nginx+uwsgi+django报错:[Errno 13] Permission denied: ‘/root/.python-eggs’
- nginx+uwsgi+django报错:[Errno 13] Permission denied: ‘/root/.python-eggs’
- 装完 mysql-python 报错 [Errno 13] Permission denied: '/root/.python-eggs'
- ExtractionError: Can’t extract file(s) to egg cache, [Errno 13] Permission denied: ‘/root/.python-eggs’
- Django报错,IOError: [Errno 13]Permission denied
- python freeline.py 报错 IOError: [Errno 13] Permission denied
- Permission denied: ... .python-eggs
- Nginx Permission denied (errno=13) 解决办法
- 解决 “python [Errno 13] Permission denied”
- 解决 “python [Errno 13] Permission denied”
- Nginx报错403 forbidden (13: Permission denied)的解决办法
- Nginx报错403 forbidden (13: Permission denied)的解决办法
- Nginx报错403 forbidden (13: Permission denied)的解决办法
- Nginx报错403 forbidden (13: Permission denied)的解决办法
- nginx报403错误(13:Permission denied)
- [Errno 13] Permission denied处理
- IOError: [Errno 13] Permission denied
- 安装python包时出现IOError: [Errno 13] Permission denied
- 【治妇科病常用的7种中药】
- yum是什么?(linux命令)
- 【安装与配置】--CollabNetSubversionEdge安装与使用
- 析取范式
- android service生命周期
- nginx+uwsgi+django报错:[Errno 13] Permission denied: ‘/root/.python-eggs’
- 关于android SDK安装失败
- 异常:android.os.NetworkOnMainThreadException
- OpenGL学习笔记1
- spring surf 简单介绍
- ./configure make make install分别是什么意思呀
- Hibernate框架下调用Mysql存储过程
- UML 类图关系(泛化 、继承、实现、依赖、关联、聚合、组合)
- oracle 重定义表