首页 > 解决方案 > 意外的 UTF-8 BOM 将 Django-app 部署到 Heroku

问题描述

我正在尝试将我的 Django 应用程序部署到Heroku。我已经完成了本教程中的几乎所有步骤。但是当我尝试完成最后一步($ git push heroku master)时,Heroku 返回了以下错误:

-----> Python app detected
 !     The latest version of Python 3.6 is python-3.6.6 (you are using python-3.7.0, which is unsupported).
 !     We recommend upgrading by specifying the latest version (python-3.6.6).
       Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.7.0
-----> Installing pip
Traceback (most recent call last):
  File "/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/vendor/pipenv-to-pip", line 24, in <module>
    main()
  File "/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/vendor/pipenv-to-pip", line 12, in main
    lockfile = json.load(f)
  File "/app/.heroku/python/lib/python3.7/json/__init__.py", line 296, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/app/.heroku/python/lib/python3.7/json/__init__.py", line 338, in loads
    s, 0)
json.decoder.JSONDecodeError: Unexpected UTF-8 BOM (decode using utf-8-sig): line 1 column 1 (char 0)
 !     Push rejected, failed to compile Python app.
 !     Push failed

什么会导致它?我该如何解决?会不会是因为 python 版本不好(推荐的是 3.6.6,但我有 3.7)?或者如果有人有类似的问题,他在哪里寻找解决方案?任何帮助将不胜感激。

编辑

-----> Python app detected
 !     The latest version of Python 3.6 is python-3.6.6 (you are using python-3.6.6, which is unsupported).
 !     We recommend upgrading by specifying the latest version (python-3.6.6).
       Learn More: https://devcenter.heroku.com/articles/python-runtimes
-----> Installing python-3.6.6
 !     Requested runtime (python-3.6.6) is not available for this stack (heroku-16).
 !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
 !     Push rejected, failed to compile Python app.
 !     Push failed

标签: pythondjangoheroku

解决方案


推荐阅读