Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

django - Heroku: No default language could be detected for this app for python even with runtime.txt

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...

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 ?

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:

Not sure where I am going wrong ?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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

Refer Docs : Heroku Docs

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.

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...