首页 > 解决方案 > YML 配置的 django elasticbeanstalk 部署问题

问题描述

出于测试目的,我正在尝试在 AWS 弹性 beantalk 中上传一个 django 项目。但是环境创建命令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

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

标签: djangoamazon-elastic-beanstalk

解决方案


您必须执行以下步骤:

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

推荐阅读