UnicodeDecodeError:部署到 Heroku 时,“utf-8”编解码器无法解码位置 0 中的字节 0xff

2024-05-19

我尝试在heroku上部署我的简单django项目,但我不明白如何解决这个问题

这是git push heroku master

remote: Traceback (most recent call last):
remote:   File "/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/vendor/runtime-fixer", line 8, in <module>
remote:     r = f.read().strip()
remote:   File "/usr/lib/python3.8/codecs.py", line 322, in decode
remote:     (result, consumed) = self._buffer_decode(data, self.errors, final)
remote: UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
remote: /tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin/steps/python: line 5: warning: command substitution: ignored null byte in input
remote: ) is not available for this stack (heroku-20).
remote:  !     Aborting.  More info: https://devcenter.heroku.com/articles/python-support
remote:  !     Push rejected, failed to compile Python app.
remote:
remote:  !     Push failed
remote:  !
remote:  ! ## Warning - The same version of this code has already been built: 898dd95ff261fc77ac4dcd00edd162d7b7c054f2
remote:  !
remote:  ! We have detected that you have triggered a build from source code with version 898dd95ff261fc77ac4dcd00edd162d7b7c054f2
remote:  ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch.
remote:  !
remote:  ! If you are developing on a branch and deploying via git you must run:
remote:  !
remote:  !     git push heroku <branchname>:main
remote:  !
remote:  ! This article goes into details on the behavior:
remote:  !   https://devcenter.heroku.com/articles/duplicate-build-version
remote:
remote: Verifying deploy...
remote:
remote: !       Push rejected to portfolio-project10.
remote:
To https://git.heroku.com/portfolio-project10.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/portfolio-project10.git'

C:...\portfolio-project>

如果有人可以帮助我,或者甚至推荐其他免费部署 django 项目的方法,那就太好了


整个回溯都在这些括号内:() is not available for this stack。这是当您请求不可用的 Python 运行时时显示的消息。在这种情况下,它看起来像你的runtime.txt https://devcenter.heroku.com/articles/python-support#specifying-a-python-version由于意外的编码,甚至无法读取。

删除它,然后创建一个包含类似内容的新文件

python-3.10.2

仅有的。确保它是 UTF-8 编码、提交并重新部署。

目前,这些是当前支持的 Python 版本,但是该列表随着新版本的发布而变化 https://devcenter.heroku.com/articles/python-support#supported-runtimes:

  • python-3.10.2
  • python-3.9.10
  • python-3.8.12
  • python-3.7.12
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

UnicodeDecodeError:部署到 Heroku 时,“utf-8”编解码器无法解码位置 0 中的字节 0xff 的相关文章

随机推荐