سؤال

I am trying to upload an image in django admin and get the OSError (permission denied).

This is the log:

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)* 

In my opinion the problem lies in the wrong python path. But I can't apparently change it.

Any ideas how to solve this problem?

هل كانت مفيدة؟

المحلول

I had both mod_wsgi and mod_python installed. So, despite my configurations for mod_wsgi, mod_python initialized first and made Apache use Python of older version. This caused all the permission issues.

See this doc: https://code.google.com/p/modwsgi/wiki/InstallationIssues#Python_Version_Mismatch

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top