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:
- a folder 'media' in root of django project
- in settings.py MEDIA_ROOT is /home/user/...django_project_folder/media/ and MEDIA_URL is http://127.0.0.1:8000/media/
- 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+')
精彩评论