将YAML转换为JSON时出错:YAML:第3行:未找到预期的键

2024-06-24 13:26:30 发布

您现在位置:Python中文网/ 问答频道 /正文

我准备了一份docker申请表。现在我想在heroku服务器上实现它,不幸的是,在命令执行过程中返回了一个错误

git push heroku master

我收到了这个错误消息

Enumerating objects: 466, done.
Counting objects: 100% (466/466), done.
Delta compression using up to 4 threads
Compressing objects: 100% (442/442), done.
Writing objects: 100% (466/466), 10.30 MiB | 1008.00 KiB/s, done.
Total 466 (delta 83), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: === Fetching app code
remote: 
remote: =!= Build failed due to an error:
remote: 
remote: =!= validate step: error converting YAML to JSON: yaml: line 3: did not find expected key
remote: 
remote: If this persists, please contact us at https://help.heroku.com/.
remote: Verifying deploy...
remote: 
remote: !   Push rejected to powerful-cove-75131.
remote: 
To https://git.heroku.com/powerful-cove-75131.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/powerful-cove-75131.git'

我的heroku.yml文件如下所示

setup:
  addons:
  - plan: heroku-postgresql
build:
  docker:
    web: Dockerfile
release:
  image: web
  command:
    - python manage.py collectstatic --noinput
run:
  web: gunicorn pvb.wsgi

Tags: todockerhttpsgitmastercomwebheroku
1条回答
网友
1楼 · 发布于 2024-06-24 13:26:30

根据this,缩进不匹配。应该是这样,

    setup:
      addons:
        - plan: heroku-postgresql
          as: database
    build:
      docker:
        web: Dockerfile
    release:
      image: web
      command:
        - python manage.py collectstatic  noinput
    run:
      web: gunicorn pvb.wsgi

相关问题 更多 >