mardi 30 juin 2015

Django S3 uploaded file urls show credentials

I am using django-storages and Amazon S3 for file storages. In my model I have: avatar = models.ImageField(_('Avatar'), upload_to='avatars/profiles/', blank=True, null=True)

The image is uploaded successfully on save, but full url with credentials is saved. In my Retrieve requests/ when I read the url from db via console) I get something like: http://ift.tt/1LzLGXn

How can I prevent this? I could strip the url before responding, but I do not need and therefore do not want to save them in this format, because all files can be accessed publicly, also no need for credentials. Ps. I though of using the post_save hook but it seemed like a hack to me.




Aucun commentaire:

Enregistrer un commentaire