Skip to main content
 首页 » 编程设计

python之无法将 python 代码部署到 heroku

2025年02月15日10xxx_UU

所以我刚开始学习制作一个 python 机器人并将其部署到 heroku。我想做一个线机器人。

我按照 Line 和教程中的说明进行操作,我下载了 sample-echo python 文件并想尝试将它部署到 heroku。

我一步一步地按照heroku中的说明操作,当我想做的时候

$ git push heroku master

我有错误

-----> Failed to detect app matching https//codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz buildpack Push failed

我已经将 buildpacks 设置为 python,这是主目录的 ss this is the master directory

我真的希望有人能帮我解决这个错误,无论如何,谁能推荐一个好的网络来学习使用 python 制作在线聊天机器人?

非常感谢

请您参考如下方法:

此问题已得到解决 here

Resolution

This error message means that Heroku was unable to automatically detect the type of app you're trying to deploy: Ruby, Node, Python, PHP, Java, etc. We look for signatures for each language we support (like a pom.xml file or package.json file).

Most apps have at least one of these signatures present, so if you see this error, it usually means an important file isn't checked into your git repository:

Java: pom.xml 
Ruby: Gemfile 
Node.js: package.json 
Python: requirements.txt / setup.py / Pipfile 
PHP: composer.json / index.php 

You should git add {file}, git commit -am 'added {file}' and then git push heroku master.

在 .git 文件夹中添加文件 requirement.txt 是不够的,您必须执行命令添加它然后推送它。它应该可以解决问题。