My Django site is live, as far as I know, everything works correctly except for when a user tries to upload a profile image they get this error:
OSError at /user/1/edit
[Errno 13] Permission denied: '/home/django/django_project/media/profile_pics/Square.jpg'
I have never seen this before so I'm not really sure what to do...
Here is the traceback:
Traceback Switch to copy-and-paste view
/usr/local/lib/python2.7/dist-packages/django/core/handlers/exception.py in inner
response = get_response(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _legacy_get_response
response = self._get_response(request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
response = self.process_exception_by_middleware(e, request) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py in view
return self.dispatch(request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/contrib/auth/mixins.py in dispatch
return super(LoginRequiredMixin, self).dispatch(request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/base.py in dispatch
return handler(request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py in post
return super(BaseUpdateView, self).post(request, *args, **kwargs) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py in post
return self.form_valid(form) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/views/generic/edit.py in form_valid
self.object = form.save() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/forms/models.py in save
self.instance.save() ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in save
force_update=force_update, update_fields=update_fields) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/base.py in _save_table
for f in non_pks] ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/files.py in pre_save
file.save(file.name, file.file, save=False) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/db/models/fields/files.py in save
self.name = self.storage.save(name, content, max_length=self.field.max_length) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/files/storage.py in save
return self._save(name, content) ...
▶ Local vars
/usr/local/lib/python2.7/dist-packages/django/core/files/storage.py in _save
fd = os.open(full_path, flags, 0o666) ...
▶ Local vars
Update:
This error also happens when user tries to upload an image in a post to the post feed, however it points to the post_pics
In the media folder instead of the profile_pic
Folder like it is doing in this error.