[英]django-storages boto3 accessing file url of a private file
I'm trying to get the generated URL of a file in a test model I've created, and I'm trying to get the correct url of the file by: modelobject.file.url
which does give me the correct url if the file is public, however if the file is private it does not automatically generate a signed url for me, how is this normally done with django-storages?我正在尝试在我创建的测试模型中获取文件的生成 URL,并且我正在尝试通过以下方式获取文件的正确 url:
modelobject.file.url
如果文件是公开的,但是如果文件是私有的,它不会自动为我生成一个签名的 url,这通常是如何使用 django-storages 完成的?
Is the API supposed to automatically generate a signed url for private files? API 是否应该为私有文件自动生成签名 url? I am getting the expected Access Denied Page for 'none' signed urls currently, and need to get the signed 'volatile' link to the file.
我目前正在获得“无”签名网址的预期访问拒绝页面,并且需要获得文件的签名“易失性”链接。
Thanks in advance提前致谢
I've figured out what I needed to do,我已经弄清楚我需要做什么,
in the Private Storage class, I forgot to put custom_domain = False
originally left this line off, because I did not think I needed it however you absolutely do in order to generate signed urls automatically.在 Private Storage 类中,我忘了把
custom_domain = False
最初离开这条线,因为我认为我不需要它,但是为了自动生成签名的 url,你绝对这样做。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.