I am trying to deploy a Django app on Heroku, but I am having compatibility issues with the requirements.txt file, it specifies "python-3.11.1". According to Heroku's documentation , Heroku stack 22 supports Python 3.11.1. But each time I try to deploy using the Heroku CLI, I get an error message.
-----> Building on the Heroku-22 stack
-----> Using buildpack: heroku/python
-----> Python app detected
-----> Using Python version specified in runtime.txt
Traceback (most recent call last):
File "/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/vendor/runtime-fixer", line 8, in <module>
r = f.read().strip()
File "/usr/lib/python3.10/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
/tmp/codon/tmp/buildpacks/0f40890b54a617ec2334fac0439a123c6a0c1136/bin/steps/python: line 9: warning: command substitution: ignored null byte in input
! Requested runtime '��python-3.11.1
! For supported versions, see: https://devcenter.heroku.com/articles/python-support
! Push rejected, failed to compile Python app.
! Push failed
I tried
git push heroku master
I have followed the buildpack checking tutorial in the documentation:
heroku buildpacks
heroku buildpacks:clear
heroku buildpacks:add heroku/python
I found the problem. I created the file runtime.txt with powershell but it by default creates the files with UTF-16LE encoding and heroku only supports UTF-8/
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.