小编use*_*167的帖子

使用python(django)记录AWS Elastic Beanstalk

如何在AWS弹性beanstalk中管理应用程序日志?我是说你把应用程序日志写到哪个文件?我在我的开发环境中使用以下日志记录配置,但是当我在AWS中部署时,这不起作用.

提前致谢!

DEBUG_LOG_DIR = BASE_DIR + "/django_debug.log"
LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    # How to format the output
    'formatters': {
        'standard': {
            'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
            'datefmt' : "%d/%b/%Y %H:%M:%S"
        },
    },
    # Log handlers (where to go)
    'handlers': {
        'null': {
            'level':'DEBUG',
            'class':'django.utils.log.NullHandler',
        },
        'log_file': {
            'level':'DEBUG',
            'class':'logging.handlers.RotatingFileHandler',
            'filename': DEBUG_LOG_DIR,
            'maxBytes': 50000,
            'backupCount': 2,
            'formatter': 'standard',
        },
        'console':{
            'level':'INFO',
            'class':'logging.StreamHandler',
            'formatter': 'standard'
        },
        'mail_admins': {
            'level': 'ERROR',
            'class': 'django.utils.log.AdminEmailHandler',
        },
    },
    # Loggers (where does …
Run Code Online (Sandbox Code Playgroud)

python django amazon-web-services amazon-elastic-beanstalk

22
推荐指数
4
解决办法
8711
查看次数

带有响应405的S3 POST请求到S3

我有S3的以下CORS配置,以便使用我的一个桶作为静态网站托管:

<?xml version="1.0" encoding="UTF-8"?>
<CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <CORSRule>
        <AllowedOrigin>*</AllowedOrigin>
        <AllowedMethod>GET</AllowedMethod>
        <AllowedMethod>POST</AllowedMethod>
        <MaxAgeSeconds>3000</MaxAgeSeconds>
    </CORSRule>
</CORSConfiguration>
Run Code Online (Sandbox Code Playgroud)

然后我有以下编辑重定向规则:

<RoutingRules>
    <RoutingRule>
    <Condition>
        <KeyPrefixEquals>abc</KeyPrefixEquals>
    </Condition>
    <Redirect>
        <HostName>myec2instance.com</HostName>
    </Redirect>
</RoutingRule>
Run Code Online (Sandbox Code Playgroud)

我想要做的是当S3收到POST/abc将请求和请求主体重定向到我的ec2实例时.重定向规则工作正常(我能够通过将POST切换到GET请求来测试它)但是由于任何原因,S3在请求是POST时返回HTTPResponse 405.有什么想法吗?

http-post amazon-s3 amazon-ec2 amazon-web-services http-status-code-405

6
推荐指数
1
解决办法
6121
查看次数