简体   繁体   English

用 S3ForMe 替换 Amazon s3

[英]Replace Amazon s3 with S3ForMe

I have added to my Django application the storage of static and multimedia files in bucket Amazon S3.我已经在我的 Django 应用程序中添加了存储桶 Amazon S3 中的静态和多媒体文件。 I need to change to another option because of problems with my account.由于我的帐户出现问题,我需要更改为其他选项。 I want to take advantage of S3ForMe.我想利用 S3ForMe。

In order to configure everything efficiently, I changed the keys, and I have to change API endpoint (which looks like this):为了有效地配置所有内容,我更改了密钥,并且必须更改 API 端点(如下所示):

<Error>
  <Code>AccessDenied</Code>
  <Message>Access Denied</Message>
  <RequestId>15554191115cb5cfe7adb60</RequestId>
  <HostId>storage0-3.s3for.me</HostId>
</Error>

I have no idea where to make this change in my Django application or on PythonAnywhere.我不知道在我的 Django 应用程序或 PythonAnywhere 中的何处进行此更改。 Where to change these APIs.在哪里更改这些 API。 When adding Amazon S3, I never added something like that.添加 Amazon S3 时,我从未添加过类似的东西。

I am assuming when you are using django-storages , you need to define AWS_S3_ENDPOINT_URL when you are not using Amazon S3.我假设当您使用django-storages storages 时,您需要在不使用 Amazon S3 时定义AWS_S3_ENDPOINT_URL You need to put it in settings.py like this:你需要像这样把它放在settings.py中:

AWS_S3_ENDPOINT_URL = 'https://storage0-3.s3for.me'

Now, if you want to serve the static contents in different path(lets say you are using cloudfront/varnish to serve the contents in a different path), then you need to add this line as well:现在,如果你想在不同的路径中提供静态内容(假设你正在使用 cloudfront/varnish 在不同的路径中提供内容),那么你还需要添加这一行:

AWS_S3_CUSTOM_DOMAIN = 'cdn.mydomain.com'

More information can be found here .可以在此处找到更多信息。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM