Reputation: 2072
I'm creating a django upload file module following this django documentation: UploadFiles
Bun when it executes
destination = open('/media/name.txt','wb+')
it throws this error
[Errno 13] Permission denied: '/media/name.txt'
But my settings are:
Due these settings, it seems very strange that this error is throwed.
Some help?
Upvotes: 1
Views: 2088
Reputation: 2899
You must had created a folder with root user ownership or with any other user. Otherwise you won't be getting this error. Check each folder and if you find root as owner then do "sudo chown -R theusernamme:theusername /folder/folder
Upvotes: 0
Reputation: 3392
You say media is at the root of the django project, but it appears django is trying to open a folder media at the root of your filesystem. Try
open('media/name.txt','wb+')
or
open('/home/pippo/...PROJECT_FOLDER/media/name.txt,'wb+')
(replace ... with the appropriate intermediate directories.)
Upvotes: 1