问题
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? :(((
回答1:
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(workercould be replaced withwebif it's a website)
回答2:
Each Heroku buildpack applies different tests to determine if it applies. For Python, the buildpack looks for a 'requirements.txt' or 'setup.py' file (see https://github.com/heroku/heroku-buildpack-python/blob/master/bin/detect). If you don't have one of those files, you can set it explicitly via heroku buildpacks:set heroku/python. See https://devcenter.heroku.com/articles/buildpacks#setting-a-buildpack-on-an-application
回答3:
I was facing same kind of error. As I am new to this area.. I used "requirement.txt" instead of "requirements.txt".
Watch out for the exact spellings.
来源:https://stackoverflow.com/questions/37899247/heroku-python-remote-rejected-error