Heroku:即使使用runtime.txt,此应用程序的python也无法检测到默认语言 [英] Heroku: No default language could be detected for this app for python even with runtime.txt
问题描述
我正在尝试将项目部署到heroku,而我正在得到这个错误:-
I am trying to deploy a project to heroku and I am getting this error:-
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 项目,我拥有heroku项目所需的一切,包括运行时。 txt
文件,但仍然出现此错误。我尝试更改Heroku支持的不同python版本,但仍然存在相同的错误。有人可以帮我吗?
If you go to my github project, I have everything required for the heroku project including runtime.txt
file but still I am getting this error. I tried changing different python versions supported by Heroku but still same error. Could anyone help me out ?
如果我添加了一个buildpack,则会出现以下错误
If I add a buildpack then I am getting the following error
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:
不确定我要去哪里了?
推荐答案
一个可能的解决方案是在应用程序创建期间指定buildpack,如:
A possible solution to this problem can be specifying the buildpack during app creation like :
$ heroku create myapp --buildpack heroku/python
或创建应用后,例如:
$ heroku buildpacks:set heroku/python
引用文档: Heroku文档
我发现的另一个问题是我没有必要 package.json
和我的Django项目中的其他文件。我通过从我的应用程序目录中删除不必要的文件来解决它。
因为这些文件阻碍了buildpack的自动检测。
The other problem I figured was that I had unnecessary package.json
and other files in my django project. I solved it by removing unnecessary files from my app directory.
Since these files were obstructing the automatic detection of buildpack.
检测失败的另一个原因可能是应用的文件夹结构错误。 Procfile
和其他heroku文件应该位于git目录的开头,否则将不会检测到您的应用。
Another reason of failed detection could be wrong folder structure of your app. The Procfile
and other heroku files should be right at the start of the git directory otherwise your app won't get detected.
这篇关于Heroku:即使使用runtime.txt,此应用程序的python也无法检测到默认语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!