部署到Heroku时,UnicodeDecodeError:utf-8;#39;编解码器无法解码位置0中的字节0xff [英] UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0 when deploying to Heroku

查看:0
本文介绍了部署到Heroku时,UnicodeDecodeError:utf-8;#39;编解码器无法解码位置0中的字节0xff的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在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看起来甚至无法读取。

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

python-3.10.2

。确保它是UTF-8编码、提交和重新部署。

目前,这些是当前支持的Python版本,但the list changes as new versions are released

  • python-3.10.2
  • python-3.9.10
  • python-3.8.12
  • python-3.7.12

这篇关于部署到Heroku时,UnicodeDecodeError:utf-8;#39;编解码器无法解码位置0中的字节0xff的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆