我正在尝试建立一个django站点,一个使用oauth2client库,以及libhttp2。
在开发独立服务器中,一切似乎都运行得很好,但是当我尝试使用mod_wsgi将其连接到apache时,我不断收到这个错误:
[Errno 13] Permission denied: '.cache'
这是追溯:
Traceback:
File "/usr/lib/pymodules/python2.6/django/core/handlers/base.py" in get_response
91. request.path_info)
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in resolve
215. for pattern in self.url_patterns:
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in _get_url_patterns
244. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/lib/pymodules/python2.6/django/core/urlresolvers.py" in _get_urlconf_module
239. self._urlconf_module = import_module(self.urlconf_name)
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py" in import_module
35. __import__(name)
File "/usr/local/django/prodapps/urls.py" in <module>
5. admin.autodiscover()
File "/usr/lib/pymodules/python2.6/django/contrib/admin/__init__.py" in autodiscover
24. import_module('%s.admin' % app)
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py" in import_module
35. __import__(name)
File "/usr/lib/pymodules/python2.6/django/contrib/auth/admin.py" in <module>
141. admin.site.register(Group, GroupAdmin)
File "/usr/lib/pymodules/python2.6/django/contrib/admin/sites.py" in register
90. validate(admin_class, model)
File "/usr/lib/pymodules/python2.6/django/contrib/admin/validation.py" in validate
20. models.get_apps()
File "/usr/lib/pymodules/python2.6/django/db/models/loading.py" in get_apps
115. self._populate()
File "/usr/lib/pymodules/python2.6/django/db/models/loading.py" in _populate
61. self.load_app(app_name, True)
File "/usr/lib/pymodules/python2.6/django/db/models/loading.py" in load_app
78. models = import_module('.models', app_name)
File "/usr/lib/pymodules/python2.6/django/utils/importlib.py" in import_module
35. __import__(name)
File "/usr/local/django/prodapps/gn/models.py" in <module>
6. from oauth2client.django_orm import CredentialsField, FlowField, Storage
File "/usr/local/lib/python2.6/dist-packages/oauth2client/django_orm.py" in <module>
28. from oauth2client.client import Storage as BaseStorage
File "/usr/local/lib/python2.6/dist-packages/oauth2client/client.py" in <module>
63. CACHED_HTTP = httplib2.Http('.cache')
File "/usr/local/lib/python2.6/dist-packages/httplib2/__init__.py" in __init__
1073. self.cache = FileCache(cache)
File "/usr/local/lib/python2.6/dist-packages/httplib2/__init__.py" in __init__
687. os.makedirs(self.cache)
File "/usr/lib/python2.6/os.py" in makedirs
157. mkdir(name, mode)
Exception Type: OSError at /
Exception Value: [Errno 13] Permission denied: '.cache'
所以,看起来像一个简单的问题 - 找出这个.cache
目录所在的位置,并让网络服务器访问它,对吗?
嗯,不 - 当我使用devserver时,.cache就在我的树中。但是apache的情况似乎并非如此?
那么这个设置在哪里?我如何调整它,或者至少找出它在哪里创建,所以我可以授予访问权限?
答案 0 :(得分:2)
问题在于Django的oauth2client代码 - 它有一个写得不好的检查,它是否可以访问文件系统,以及缓存目录的硬编码相对路径:
http://code.google.com/p/google-api-python-client/issues/detail?id=75