在我在命令行上执行任何操作之前,必须加载AWS S3

时间:2018-03-25 01:53:33

标签: python django amazon-web-services amazon-s3

我有一个与s3集成的django项目,每次我想在命令行上执行某些操作,例如python manage.py migrate,终端必须首先加载:

BEGIN REQUEST++++++++++++++++++++++++++++++++++++
Request URL = https://ec2.amazonaws.com?Action=DescribeRegions&Version=2013-10-15

RESPONSE++++++++++++++++++++++++++++++++++++
Response code: 200

<?xml version="1.0" encoding="UTF-8"?>
<DescribeRegionsResponse xmlns="http://ec2.amazonaws.com/doc/2013-10-15/">
    <requestId>936a670c-3q31-33kc-8713-1d0gbe6ad222</requestId>
    <regionInfo>
        <item>
            <regionName>ap-south-1</regionName>
            <regionEndpoint>ec2.ap-south-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>eu-west-3</regionName>
            <regionEndpoint>ec2.eu-west-3.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>eu-west-2</regionName>
            <regionEndpoint>ec2.eu-west-2.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>eu-west-1</regionName>
            <regionEndpoint>ec2.eu-west-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>ap-northeast-2</regionName>
            <regionEndpoint>ec2.ap-northeast-2.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>ap-northeast-1</regionName>
            <regionEndpoint>ec2.ap-northeast-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>sa-east-1</regionName>
            <regionEndpoint>ec2.sa-east-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>ca-central-1</regionName>
            <regionEndpoint>ec2.ca-central-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>ap-southeast-1</regionName>
            <regionEndpoint>ec2.ap-southeast-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>ap-southeast-2</regionName>
            <regionEndpoint>ec2.ap-southeast-2.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>eu-central-1</regionName>
            <regionEndpoint>ec2.eu-central-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>us-east-1</regionName>
            <regionEndpoint>ec2.us-east-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>us-east-2</regionName>
            <regionEndpoint>ec2.us-east-2.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>us-west-1</regionName>
            <regionEndpoint>ec2.us-west-1.amazonaws.com</regionEndpoint>
        </item>
        <item>
            <regionName>us-west-2</regionName>
            <regionEndpoint>ec2.us-west-2.amazonaws.com</regionEndpoint>
        </item>
    </regionInfo>
</DescribeRegionsResponse>

这会导致我的命令执行延迟几秒钟。有什么方法可以防止这种情况发生,因为它会导致开发延迟。

settings.py

from draft1.aws.conf import *
from draft1.aws.conf import S3_URL, AWS_STORAGE_BUCKET_NAME
STATIC_URL = S3_URL + 'static/'
MEDIA_URL = '//%s.s3.amazonaws.com/media/' % AWS_STORAGE_BUCKET_NAME
MEDIA_ROOT = MEDIA_URL
ADMIN_MEDIA_PREFIX = STATIC_URL + 'admin/'

0 个答案:

没有答案