Python heroku -app not compatible with buildpack

不打扰是莪最后的温柔 提交于 2021-01-28 02:27:31

问题


I read all the previous posts about it but still couldn't correct it. I added requirements.txt and Procfile in the directory in my computer created by Heroku. Procfile reads "web: python Chat Server.py". Also added runtime.txt in the same directory that reads "python-3.6.2".However, it keeps giving the same error again in the command prompt. How can I solve this? This is the entire error message:

"C:\Users\asus\chat_server>git push heroku master Counting objects: 6, done. Delta compression using up to 4 threads. Compressing objects: 100% (4/4), done. Writing objects: 100% (6/6), 1.14 KiB | 585.00 KiB/s, done. Total 6 (delta 1), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> App not compatible with buildpack: https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to boiling-stream-15219. remote: To https://git.heroku.com/boiling-stream-15219.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/boiling-stream-15219.git' "


回答1:


Anyone reading this: you'll need two files:

First file: requirements.txt containing something like: gunicorn==19.7.1 or whatever the results of pip freeze > requirements.txt are.

Second file: Procfile containing something like: web: gunicorn app:app or potentially blank. Note that app:app in this example is a reference to your python filename. It means that every time a web process is declared, and a dyno of this type is started, also run the command gunicorn app:app to start your web server.

Then git add . and git commit -m "added Procfile and requirements.txt".

Then run git push heroku master to push from your local master branch to the heroku remote.




回答2:


In addition to JaredH's answer, make sure that your current branch is master before you run git push heroku master.



来源:https://stackoverflow.com/questions/48341454/python-heroku-app-not-compatible-with-buildpack

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!