Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
144 views
in Technique[技术] by (71.8m points)

Django / file uploads permissions

I wrote a django app, but I have a little problem with the file permissions of the uploads files from a web form.

Basically I can upload a .mp3 file but it always keep chmod 600.

The container folder has chmod 775, and the umask is set to 022.

I'm in a shared hosting service.

question from:https://stackoverflow.com/questions/608579/django-file-uploads-permissions

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Try this in your settings.py if you use Python 2:

FILE_UPLOAD_PERMISSIONS = 0644

In Python 3 octal numbers must start with 0o so the line would be:

FILE_UPLOAD_PERMISSIONS = 0o644

For more details see the documentation.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...