python - ubuntu 18.04 上带有 Mod_WSGI 的 Django,Apache2 媒体/权限被拒绝

标签 python django apache2 mod-wsgi ubuntu-18.04

我正在尝试使用 Mode_WSGI 在 Ubuntu 18.04 上使用 Apache2 部署我的 Django(1.10) 项目

我已将 home 中的项目文件夹设置为 Fetchors 目录,并向其添加权限:

total 40
drwxr-xr-x 6 abdul abdul    4096 Feb 10 15:48 .
drwxr-xr-x 5 root  root     4096 Feb 11 04:40 ..
-rw------- 1 abdul abdul    3930 Feb 11 02:14 .bash_history
-rw-r--r-- 1 abdul abdul     220 Apr  4  2018 .bash_logout
-rw-r--r-- 1 abdul abdul    3771 Apr  4  2018 .bashrc
drwx------ 3 abdul abdul    4096 Feb 10 15:37 .cache
drwx------ 3 abdul abdul    4096 Feb 10 15:34 .gnupg
-rw-r--r-- 1 abdul abdul     807 Apr  4  2018 .profile
drwx------ 2 abdul abdul    4096 Feb 10 15:34 .ssh
drwxrwxr-x 9 abdul www-data 4096 Feb 11 06:27 Fetchors

以下是 media 目录内的权限:

total 16
drwxrwxr-x 4 abdul www-data 4096 Feb 10 15:37 .
drwxrwxr-x 9 abdul www-data 4096 Feb 11 06:27 ..
drwxrwxr-x 2 abdul www-data 4096 Feb 10 15:37 driver_image
drwxrwxr-x 2 abdul www-data 4096 Feb 10 15:46 product_image

我正在创建一个 proucct 对象,需要将产品图像保存在 product_image 文件夹中,但它显示:

[Errno 13] Permission denied: 'media/product_image'

如何解决这个问题?

提前致谢!

最佳答案

通过在终端中运行此命令来授予对媒体文件夹的权限

sudo chmod -R 777 media

但这是一个糟糕的解决方案,请遵循此答案的建议 https://stackoverflow.com/a/21797786/5301788

关于python - ubuntu 18.04 上带有 Mod_WSGI 的 Django,Apache2 媒体/权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54625190/

相关文章:

python - 在for循环中更改django表单的ID

javascript - jquery .load() 函数不返回最新帖子

python - List、Series、Dictionary、Dataframes——什么时候使用哪个以及为什么?

python - Python 解释器如何为不同的方法分配内存?

django - 检查用户是否属于多对多关系 django

php - 如何调试 "internal server error"?

apache2 - EasyPHP apache 意外结束

Django、apache、mod_wsgi - 错误 : Premature end of script headers

python - 如何使用 Autokey 移动应用程序窗口?

python - GmailAPI : "Error sending test message to Cloud PubSub projects/[project-id]/topics/[topic-id] : User not authorized to perform this action."?