简体   繁体   English

Python heroku -app与buildpack不兼容

[英]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. 我在Heroku创建的计算机目录中添加了requirements.txt和Procfile。 Procfile reads "web: python Chat Server.py". Procfile读取“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. 还将runtime.txt添加到读取“python-3.6.2”的同一目录中。但是,它在命令提示符中再次给出相同的错误。 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 ' " “C:\\ Users \\ asus \\ chat_server> git push heroku master计数对象:6,完成。使用最多4个线程进行增量压缩。压缩对象:100%(4/4),完成。写入对象:100%(6 / 6),1.14 KiB | 585.00 KiB / s,完成。总计6(增量1),重用0(delta 0)远程:压缩源文件...完成。远程:构建源:远程:远程:----- >应用程序与buildpack不兼容: https ://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz remote:更多信息: https//devcenter.heroku.com/articles/buildpacks#detection-failure remote:remote:!推送失败的远程:验证部署...远程:远程:!推送拒绝到沸腾流-15219。远程:到https://git.heroku.com/boiling-stream-15219.git ![远程拒绝] master - > master(pre-receive hook拒绝)错误:无法将某些引用推送到' 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. 第一个文件: requirements.txt包含类似: gunicorn==19.7.1pip freeze > requirements.txt结果。

Second file: Procfile containing something like: web: gunicorn app:app or potentially blank. 第二个文件: Procfile包含类似: web: gunicorn app:app或者可能是空白的。 Note that app:app in this example is a reference to your python filename. 请注意,此示例中的app:app是对python文件名的引用。 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. 这意味着每次声明web进程并启动此类型的gunicorn app:app ,还要运行命令gunicorn app:app来启动Web服务器。

Then git add . 然后git add . and git commit -m "added Procfile and requirements.txt" . 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. 然后运行git push heroku master从本地master分支推送到heroku远程。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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