Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango - Media upload [Errno 13] Permission denied
    primarykey
    data
    text
    <p>I'm having some trouble getting django to play nice with image uploads. My script will create directories based on the date like so:</p> <pre><code>file = models.FileField(upload_to='uploads/%m-%Y/') </code></pre> <p>Now, if I create the dated directory in the uploads folder and chmod the folder to 755, the upload works fine, but if I try to chmod the uploads folder without creating the dated sub folder (which I need django to do), I am getting a permissions error.</p> <p>How do I make it so a folder will allow the creation of sub folders? </p> <p>Here is a traceback:</p> <pre><code>Django Version: 1.3 Python Version: 2.5.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.admin', 'tagging', 'mediamanager', 'livesettings', 'projects'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware') Traceback: File "/var/lib/python-support/python2.5/django/core/handlers/base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "/var/lib/python-support/python2.5/django/utils/decorators.py" in _wrapped_view 93. response = view_func(request, *args, **kwargs) File "/var/lib/python-support/python2.5/django/contrib/auth/decorators.py" in _wrapped_view 23. return view_func(request, *args, **kwargs) File "/var/www/enigma-dev/enigma/mediamanager/views.py" in upload_media 24. m.upload_media(data=form.cleaned_data, params=params) File "/var/www/enigma-dev/enigma/mediamanager/models.py" in upload_media 63. self.save() File "/var/lib/python-support/python2.5/django/db/models/base.py" in save 460. self.save_base(using=using, force_insert=force_insert, force_update=force_update) File "/var/lib/python-support/python2.5/django/db/models/base.py" in save_base 543. for f in meta.local_fields if not isinstance(f, AutoField)] File "/var/lib/python-support/python2.5/django/db/models/fields/files.py" in pre_save 255. file.save(file.name, file, save=False) File "/var/lib/python-support/python2.5/django/db/models/fields/files.py" in save 92. self.name = self.storage.save(name, content) File "/var/lib/python-support/python2.5/django/core/files/storage.py" in save 49. name = self._save(name, content) File "/var/lib/python-support/python2.5/django/core/files/storage.py" in _save 166. os.makedirs(directory) File "/usr/lib/python2.5/os.py" in makedirs 171. mkdir(name, mode) Exception Type: OSError at /media-manager/upload/ Exception Value: [Errno 13] Permission denied: '/var/www/site-dev/site/static/uploads/04-2011' </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload