简体   繁体   中英

Python heroku -app not compatible with buildpack

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 ' "

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.

除了JaredH的答案之外,在运行git push heroku master之前,请确保您当前的分支是git push heroku master

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM