Heroku:即使使用 runtime.txt 也无法检测到此应用程序的默认语言 [英] Heroku: No default language could be detected for this app for python even with runtime.txt

查看:35
本文介绍了Heroku:即使使用 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 项目包括 runtime.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

或在应用创建后,例如:

or after app creation like:

$ heroku buildpacks:set heroku/python

参考文档:Heroku 文档

我想到的另一个问题是我的 django 项目中有不必要的 package.json 和其他文件.我通过从我的应用程序目录中删除不必要的文件来解决它.
由于这些文件阻碍了 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 也无法检测到此应用程序的默认语言的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆