【问题标题】:django elasticbeanstalk deployment issue with YML configYML 配置的 django elasticbeanstalk 部署问题
【发布时间】:2020-09-08 23:59:11
【问题描述】:

出于测试目的,我正在尝试上传一个 django 项目 在 AWS 弹性豆茎中。但是环境创建命令eb create my-env 给了我这个错误:

ERROR: InvalidParameterValueError - The configuration file .ebextensions/django.config in application version app-8036-200522_133554 contains invalid YAML or JSON. YAML exception: Invalid Yaml: while scanning for the next token
found character         '\t' that cannot start any token
 in "<reader>", line 2, column 1:
        aws:elasticbeanstalk:container: ... 
    ^
, JSON exception: Invalid JSON: Unexpected character (o) at position 0.. Update the configuration file.

这是我的文件夹结构。

.
├── db.sqlite3
├── .ebextensions
│   └── django.config
├── .elasticbeanstalk
│   └── config.yml
├── .gitignore
├── manage.py
├── requirements.txt
├── static
└── TaxKH_API
    ├── asgi.py
    ├── __init__.py
    ├── settings.py
    ├── urls.py
    └── wsgi.py

这是我的 .ebextensions/django.config 我已经使用在线工具验证了 YML。关于没有问题 YML 格式化和验证。

option_settings:
  aws:elasticbeanstalk:container:python:
    WSGIPath: TaxAPI/wsgi.py

这是我没有在我的文件中使用任何类型的选项卡的屏幕截图 screenshot

【问题讨论】:

  • 看来,在您的 django.config 中,您有一些 tab 来缩进这些行。您应该使用空格而不是制表符
  • 不,没有多余的字符,我在所有地方都使用了空格而不是制表符
  • 错误提示您在 aws:elasticbeanstalk:container 之前有 \t。也许从浏览器中复制了一些奇怪的隐形字符。您是否尝试手动重写文件?
  • 我已经编辑了帖子并粘贴了截图。你可以看到没有任何地方的\t
  • 是的,我尝试手动重写文件

标签: django amazon-elastic-beanstalk


【解决方案1】:

您必须执行以下步骤:

  1. 删除 django.config 中的所有选项卡并仅使用空格(缩进 2 个空格)
  2. 在运行eb 命令(如eb createeb deploy)之前,您必须将更改添加并提交到本地存储库以反映更改。 eb CLI 仅从您的存储库中读取文件。

【讨论】:

    猜你喜欢
    • 2017-06-16
    • 1970-01-01
    • 2015-04-17
    • 2017-08-02
    • 2014-12-14
    • 1970-01-01
    • 2011-03-19
    • 1970-01-01
    • 2011-03-28
    相关资源
    最近更新 更多