I am developing a Django application that includes the ability for users to upload a picture that is displayed on certain pages. However, I am encountering an error that is related to the file permissions given to the image files upon upload. Some (but not all) pictures do not show up on the pages. When I try to access them directly (with the image URL) I get a 403 error. I checked on the server via SSH, and found that some pictures were getting different file permissions than the others. The pictures that did show up had permission of 644 (so they are readable by everyone), while the ones that didn't show had permissions of 600 (not readable by anyone other than owner). I am bewildered as to why some uploads would receive different permissions than others. The pictures are being stored in a folder in my static application. I changed all the picture files to have correct permissions, but some subsequent uploads are still having the permissions problem. Is there something I need to do to force all uploaded files to to have read permissions for everyone? asked 08 Apr '18, 18:24 pda6ne |
Run the following commands within the media directory via SSH,
This should reset the permissions to a safe default and fix upload issues. answered 08 Apr '18, 22:11 johns This answer only solves the problem for existing files, not future ones. Albeit the webfaction forum seems like the wrong place for a question about django internals?
(20 Dec '19, 20:31)
mrcoles
|
It looks like you want to set Django docs: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FILE_UPLOAD_PERMISSIONS Found this via a StackOverflow question: https://stackoverflow.com/a/608751/376489 answered 20 Dec '19, 20:43 mrcoles |
This question is probably better suited for StackOverflow, I don’t think there’s anything specific to Webfaction about it.