将YAML转换为JSON时出错:yaml:第3行:找不到预期的密钥

时间:2020-01-15 11:18:14

标签: python django docker heroku docker-compose

我准备了一个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

1 个答案:

答案 0 :(得分:0)

根据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