I just ran into this same problem. And found the solution if you are hosting with Apache as your server. For instance if my settings were:
MEDIA_ROOT = '/var/www/media/geekingreen'
then I would simply need to give that folder the correct permissions recursively to make sure that any sub-folders also have the same permission. The default group for apache is www-data so to give permission to my django app I would run these commands.

在Ubuntu上,Apache+Nginx环境的Django应用中遇到上传文件时的OSError Permission denied问题。问题源于文件夹未授予www-data用户写权限。解决方案包括将文件夹权限递归更改为www-data组并赋予写权限。通过运行chgrp和chmod命令成功解决问题。

17万+

被折叠的 条评论
为什么被折叠?



