PermissionError:[Errno 13] Django中的权限被拒绝 [英] PermissionError: [Errno 13] Permission denied in Django

查看:188
本文介绍了PermissionError:[Errno 13] Django中的权限被拒绝的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一个非常奇怪的问题.

I have encountered a very strange problem.

我正在使用django,我在服务器上创建了一个目录,并尝试通过以下方式将pickle文件保存到其中:

I'm working with django, I create a directory on server, and try to save pickle file into it, this way:

with open(path, 'wb') as output: 
  pickle.dump(obj, output, pickle.HIGHEST_PROTOCOL)

并获得:

PermissionError: [Errno 13] Permission denied

我尝试通过这种方式授予该目录的所有权限:

I tried to give all permissions to this directory, this way:

os.chmod(save_full_path, stat.S_IWOTH | stat.S_IWUSR | stat.S_IWGRP)

但这没有帮助.

尽管目录似乎具有所有权限(0o777),但仍然出现此错误.

Although directory seems to have all permissions(0o777), I still get this error.

顺便说一句,将上传的文件保存到此目录没有问题.

By the way, I have no problems with saving uploaded files to this directory.

我是django的新手,如果有人向我解释我在做什么错,我将不胜感激.

I'm very new to django, I would really appreciate if someone explained me what am I doing wrong.

推荐答案

似乎我自己已经弄清楚了.找到了这个问题,并确切地写了那里的内容.

It seems like i have figured out this myself. Found this question, and did excactly what is written there.

尝试写入时权限被拒绝视图中的文件

但是我仍然不知道我的问题是什么:(

But I still don't know what was the problem in my case :(

这篇关于PermissionError:[Errno 13] Django中的权限被拒绝的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆