0

我正在尝试在 django admin 中上传图像并获取 OSError(权限被拒绝)。

这是日志:

Request Method: POST
Request URL:    .........
Django Version: 1.5.3
Exception Type: OSError
Exception Value:
[Errno 13] Permission denied: .......
Exception Location: /usr/lib/python2.6/os.py in makedirs, line 157
Python Executable:  /usr/bin/python
Python Version: 2.6.5
Python Path:
['/home/deployer/virtualenvs/python-2.7.5/lib/python2.7/site-packages',
 '/usr/lib/python2.6',
 '/usr/lib/python2.6/plat-linux2',
 '/usr/lib/python2.6/lib-tk',
 '/usr/lib/python2.6/lib-old',
 '/usr/lib/python2.6/lib-dynload',
 '/usr/lib/python2.6/dist-packages',
 '/usr/lib/python2.6/dist-packages/PIL',
 '/usr/lib/python2.6/dist-packages/gst-0.10',
 '/usr/lib/pymodules/python2.6',
 '/usr/lib/python2.6/dist-packages/gtk-2.0',
 '/usr/lib/pymodules/python2.6/gtk-2.0',
 '/usr/local/lib/python2.6/dist-packages',
 ..........]

TRACEBACK:
...........
    /home/deployer/virtualenvs/python-2.7.5/lib/python2.7/site-packages/django/core/files/storage.py in _save
    *171. os.makedirs(directory)*
    /usr/lib/python2.6/os.py in makedirs
    *150. makedirs(head, mode)* 
    /usr/lib/python2.6/os.py in makedirs
    *157. mkdir(name, mode)* 

在我看来,问题在于错误的 python 路径。但我显然无法改变它。

任何想法如何解决这个问题?

4

1 回答 1

2

我安装了 mod_wsgi 和 mod_python。因此,尽管我对 mod_wsgi 进行了配置,但 mod_python 首先初始化并让 Apache 使用旧版本的 Python。这导致了所有权限问题。

请参阅此文档:https ://code.google.com/p/modwsgi/wiki/InstallationIssues#Python_Version_Mismatch

于 2013-10-18T13:19:36.010 回答