I am trying to deploy my first django app on herok

2019-07-19 15:19发布

问题:

I have unsettling the buildpacks but it didn't work and I do have requirements.txt and procfile as well as virtual env.

 (deploy) C:\Users\Samar\Desktop\deploy\blog>git push heroku master
 Counting objects: 127, done.
 Delta compression using up to 4 threads.
 Compressing objects: 100% (122/122), done.
 Writing objects: 100% (127/127), 45.25 KiB | 0 bytes/s, done.
 Total 127 (delta 47), reused 0 (delta 0)
 remote: Compressing source files... done.
 remote: Building source:
 remote:
 remote: -----> Python app detected
 remote: -----> Installing Python 3.6.0
 remote: -----> Installing pip
 remote: -----> Installing requirements with pip remote:/app/tmp/buildpacks/779a8bbfbbe7e1b715476c0b23fc63a2103b3e4131eda558669aba8fb5e6e05682419376144189b29beb5dee6d7626b4d3385edb0954bffea6c67d8cf622fd51/bin/steps/pip-install: line 5: /app/.heroku/python/bin/pip: No such file or directory
 remote:  !     Push rejected, failed to compile Python app.
 remote:
 remote:  !     Push failed
 remote: Verifying deploy...
 remote:
 remote: !       Push rejected to trueblog.
 remote:To https://git.heroku.com/trueblog.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/trueblog.git'

回答1:

Heroku only supports specifying a small set of python versions in runtime.txt. They currently only support 2.7.13 or 3.6.1. If you specify any other runtime version, you get this wholly unhelpful error.

Change your runtime.txt to use one of the supported versions.



回答2:

I had the same problem when using python 3.5.1 but when I upgraded to python 3.6.1 everything worked.

Create a runtime.txt file and add python-3.6.1 into it and place it into your base directory which is where you have your manage.py file. That should resolve your problem.