我正在尝试部署 project到 heroku,我收到这个错误:-
Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (64/64), done.
Writing objects: 100% (70/70), 17.36 KiB | 0 bytes/s, done.
Total 70 (delta 23), reused 3 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! No default language could be detected for this app.
remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically.
remote: See https://devcenter.heroku.com/articles/buildpacks
remote:
remote: ! Push failed
remote: Verifying deploy...
如果你去我的github project ,我拥有 heroku 项目所需的一切,包括 runtime.txt
文件,但我仍然收到此错误。我尝试更改 Heroku 支持的不同 python 版本,但仍然出现相同的错误。谁能帮帮我?
如果我添加一个构建包然后我收到以下错误
Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (64/64), done.
Writing objects: 100% (70/70), 17.36 KiB | 0 bytes/s, done.
Total 70 (delta 23), reused 3 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Failed to detect app matching https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/python.tgz buildpack
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
不确定我哪里出错了?
最佳答案
此问题的可能解决方案是在创建应用程序期间指定构建包,例如:
$ heroku create myapp --buildpack heroku/python
或在应用创建之后:
$ heroku buildpacks:set heroku/python
引用文档:Heroku Docs
我想到的另一个问题是我的 django 项目中有不必要的 package.json
和其他文件。我通过从我的应用程序目录中删除不必要的文件来解决它。
由于这些文件阻碍了 buildpack 的自动检测。
检测失败的另一个原因可能是您的应用错误的文件夹结构。 Procfile
和其他 heroku 文件应该位于 git 目录的开头,否则您的应用将不会被检测到。
关于python - Heroku:即使使用 runtime.txt,也无法检测到此 python 应用程序的默认语言,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44232967/