I tried to deploy my simple django project on heroku, but i couldn't understand how to solve this problem
This is the 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>
It would be very nice if anyone could help me with this, or even recommending an other way to deploy django projects for free
CodePudding user response:
That entire traceback is inside these parentheses: () is not available for this stack
. That is the message shown when you request a Python runtime that isn't available. In this case, it looks like your runtime.txt
can't even be read due to an unexpected encoding.
Delete it, then create a new file containing something like
python-3.10.2
only. Make sure it is UTF-8 encoded, commit, and redeploy.
At the moment, these are the currently supported Python versions, but the list changes as new versions are released:
python-3.10.2
python-3.9.10
python-3.8.12
python-3.7.12