よしたく blog

ほぼ週刊で記事を書いています

DjangoをHerokuにプッシュすると出るApp not compatible with buildpack

f:id:yoshitaku_jp:20180711100334p:plain

エラー内容

DjangoのwebアプリケーションをCircleCI経由でHerokuにpushしていたら、そこで出たエラーがでた。

#!/bin/bash -eo pipefail
git push https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git master
Counting objects: 48, done.
Delta compression using up to 36 threads.
Compressing objects: 100% (18/18), done.
Writing objects: 100% (48/48), 4.55 KiB | 0 bytes/s, done.
Total 48 (delta 21), reused 47 (delta 20)
remote: Compressing source files... done.        
remote: Building source:        
remote: 
remote: -----> App not compatible with buildpack: https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/python.tgz        
remote:        More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure        
remote: 
remote:  !     Push failed        
remote: Verifying deploy...        
remote: 
remote: !   Push rejected to horse-card.        
remote: 
To https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://heroku:$HEROKU_API_KEY@git.heroku.com/$HEROKU_APP_NAME.git'
Exited with code 1

(一部$HEROKU_API_KEYと$HEROKU_APP_NAMEに変更

原因

原因は、ルートにrequirements.txtがないことだった。開発環境と本番環境でrequirements.txtを使い分けたいためにフォルダ分けしたことが引き起こしたものだった。これはDjangoというよりもPythonのアプリケーションをHerokuに上げるときにおこるものだと思う。

各種ファイル...
requirements
└┬base.xt
 ├development.txt
 └production.txt

Django関連】

yoshitaku-jp.hatenablog.com

yoshitaku-jp.hatenablog.com