Heroku Python远程拒绝错误 [英] Heroku Python Remote Rejected error
问题描述
我正在制作一个简单的Python Bot,它可以像 python file.py
一样运行。我在我的电脑中创建了一个文件夹,其中有3个文件 file.py list.txt Procfile
。在Procfile中,我写了 worker:python file.py
,我选择了工作者作为命令行应用程序,并且我的计划是在服务器上永远运行该Python文件。我比 git init
, heroku git:remote -a py-bot-xyz
其中py-bot-xyz是我在My Heroku Dashboard中创建的应用程序比 git add。
, git commit -am更好
&安培;最后 git push heroku master
。
这就是错误发生的地方,打印出来
远程:压缩源文件...完成。
远程:建立资源:
远程:
远程:
远程:!推送被拒绝,未检测到Cedar支持的应用程序
remote:HINT:Heroku无法检测到buildpack
remote时发生:自动使用此应用程序。
remote:请参阅https://devcenter.heroku.com/articles/buildpacks
remote:
remote:验证部署....
remote:
remote: !推拒绝py-bot-xyz。
remote:
至https://git.heroku.com/py-bot-xyz.git
! [远程拒绝] master - > master(预接收钩拒绝)
错误:未能将一些文件推送到'https://git.heroku.com/py-bot-xyz.git'
现在,当我去Heroku的Dashboard Build Failed in Activity。我现在能做什么?为了成功地将python代码推送到heroku,你应该有一个requirements.txt文件和一个Procfile文件。进入你的项目文件夹在终端/命令行,并输入以下命令将生成必要的文件。提交它们并推送应该工作。
-
pip freeze> requirements.txt
(您可能需要安装pip,如果使用的是较旧的python版本) 您可以用<$ c $替换<
I am making a Simple Python Bot which can be run like python file.py
. I created a Folder in my PC having 3 files file.py list.txt Procfile
. In Procfile i wrote worker: python file.py
, I choosed worker as it a Command Line application and my plan is to run that Python File forever on the server. Than i did git init
, heroku git:remote -a py-bot-xyz
where py-bot-xyz is the application which i created in My Heroku Dashboard and than git add .
, git commit -am "make it better"
& finally git push heroku master
.
That's where the error occurs, that prints out
remote: Compressing source files... done.
remote: Building source:
remote:
remote:
remote: ! Push rejected, no Cedar-supported app detected
remote: HINT: This occurs when Heroku cannot detect the buildpack
remote: to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: Verifying deploy....
remote:
remote: ! Push rejected to py-bot-xyz.
remote:
To https://git.heroku.com/py-bot-xyz.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/py-bot-xyz.git'
Now, when i go to Heroku's Dashboard Build Failed in Activity. What can i do now? :(((
To successfully push python code to heroku you should have a requirements.txt and a Procfile. Go to your project folder in terminal/commandline and enter the following commands which will generate the necessary files. Commit them and push should work.
pip freeze > requirements.txt
(you might need to install pip, if using older python version)echo "worker: python yourfile.py" > Procfile
(worker
could be replaced withweb
if it's a website)
这篇关于Heroku Python远程拒绝错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!