开发者

Django file upload: permission problem, error 13

I'm creating a django module to upload files, and i'm following this django documentation: FileUploads

But when it executes destination=destination = open('/media/name.txt','wb+')

it throws this error:

[Errno 13] Permission denied: '/media/name.txt'

My settings are:

  1. a folder 'media' in root of django project
  2. in settings.py MEDIA_ROOT is /home/user/...django_project_folder/media/ and MEDIA_URL is http://127.0.0.1:8000/media/
  3. folder media has 777 as permissions, and executing ls -l media's owner is the same that runs the project (checked 开发者_开发知识库through lsof -i command)

Due these settings, i consider very strange this error.

Some help?


try:

open('media/name.txt','wb+')

insead of:

open('/media/name.txt','wb+')
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜