Nginx / Django File Upload Permissions
I noticed today that whenever I upload a file through my Django site, the file is uploaded with 0600 file permissions, when whenever a non-root user wants to view the file (nginx), 403 is displayed.
It just started today, from what I can tell. I checked the files file_upload_permissions and file_upload_directory_permissions in the Django settings file and both are set to 0644.
I haven't updated Linux / Django recently, so this shouldn't be the reason, any help would be greatly appreciated.
Thank,
Sam
+3
samroberts707
source
to share
1 answer
If you've recently switched to Python 3, check out here for a reference to octal literals in Python 3. Changing the following settings should fix:
FILE_UPLOAD_PERMISSIONS = 0o644
It is also useful when writing Python 2-3 compatible code.
+4
McMutton
source
to share