gpt4 book ai didi

Django 存储 s3 媒体网址为 https ://instead of http://

转载 作者:行者123 更新时间:2023-12-04 02:50:26 26 4
gpt4 key购买 nike

当使用 django-storage s3 提供媒体服务时,正在生成的媒体 URL 是这样的:

https://mybucket.s3.amazonaws.com/myimage.jpg?Signature=5ifoyLqzmtfVNS1ovfzVvN92RH0%3D&Expires=1363124819&AWSAccessKeyId=AKIAJ7ZTU7K4SPYKGOFA

导致图片因https无法显示:
    You attempted to reach mybucket.s3.amazonaws.com,
but instead you actually reached a server identifying itself as *.s3.amazonaws.com.
This may be caused by a misconfiguration on the server or by something more serious. An attacker on your network could be trying to get you to visit a fake (and potentially harmful) version of mybucket.s3.amazonaws.com.

我需要将图像作为 HTTP 而不是 HTTPS

我的设置是:
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto.S3BotoStorage'
AWS_ACCESS_KEY_ID = "AKIAJ....K4SPYKGOFA"
AWS_SECRET_ACCESS_KEY = "2Y7G98JoCRzAEp....rPoCjWZuwDaQ"
AWS_STORAGE_BUCKET_NAME = "mybucket"

我尝试将 media_url 和 s3_url 设置为普通的 http,但没有任何改变。

我正在使用 Django 1.5

最佳答案

我会尝试将此属性添加到您的设置中:

AWS_S3_SECURE_URLS = False

在简要浏览 django-storages 文档后,它看起来似乎没有被记录下来,但是这个博客更多地讨论了它。
http://www.eliotk.net/05/30/force-http-with-django-storages-and-s3boto/

关于Django 存储 s3 媒体网址为 https ://instead of http://,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15372041/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com