无法使用配置文件设置 AWS Elastic Beanstalk 静态路径

Can't set AWS Elastic Beanstalk static path with config file

我的项目 .ebextensions 目录中有一个 config 文件,其中包含

option_settings:
  "aws:elasticbeanstalk:container:python:staticfiles":
    "/static/": "sitetest/static/"

但是我的 EB 环境不会更改 /static/ 的设置以响应将其推送到 AWS。

我可以验证同一目录中的其他 config 设置——例如对于使用

的环境变量
option_settings:
  "aws:elasticbeanstalk:application:environment":
    SOME_VAR: "foo"

或使用

的容器命令
container_commands:
  00_syncdb:
    command: "python manage.py db upgrade"
    leader_only: true

表现符合预期。

为什么 AWS Elastic Beanstalk 的静态路径没有根据我的配置文件中的设置更改?

ebextensions 是较低的优先级设置。这意味着如果您使用 cli/console/api 在 ebextensions 中设置任何内容,ebextension 将不再生效。

您可以使用 cli/api 删除设置以使 ebextension 再次工作。

使用 EB CLI,您可以使用 eb config 然后从文件中删除相关行。

使用 AWS CLI,您可以使用:

aws elasticbeanstalk update-environment --environment-name MyEnvName --region us-west-2 --options-to-remove Namespace=aws:elasticbeanstalk:container:python:staticfiles,OptionName=/static/