uploading to media folder gives Permission Denied

Hi, I am trying to upload to my media folder but I get the error: OSError: [Errno 13] Permission denied: '/media/img'

Under the Web tab I have URL set to media/ and Directory set to /home/lelap2/CityDigits/CityDigits/media.

My has these: MEDIA_ROOT = '/home/lelap2/CityDigits/CityDigits/media' MEDIA_URL = '/media/'

Is there something else I should set to allow uploads?

Thanks, Lela

That permission denied message looks like you're trying to write to the disk at /media/img which is not a directory that you can write to. You should change the directory that you're trying to write to to /home/lelap2/CityDigits/CityDigits/media.

Thanks. On user upload of an image, our Django app autogenerates creates an img directory and gives the uploaded image a generated name based on the date. My understanding is that Django saves any ImageField or FileField in a model to the media directory specified in I'm confused about the /media/ directory not being writable because I thought Django would save media files to the web directory in a deployment settings. Have other people been able to use PythonAnywhere to allow users to upload files like this?

That all sounds like it should work OK. Could I take a look at your code? (You don't need to do anything more than say "yes" here -- we can access your code but have a policy of not looking without permission to protect your privacy.) It might also help if you have a page I can use to try to reproduce the problem -- send me the details via the "Send feedback" link above if you want to keep them non-public.

This is happening to me, and trying the fix it still gives me the same error, however this time it is saying it doesn't have access to '/home/<user>' even though I put the full path to the media folder and not just that small string. Anyone know what gives?

Could you post the complete error stacktrace?