LoginSignup
4
2

More than 3 years have passed since last update.

DiscordのBotをherokuにデプロイするときにハマった件

Posted at

1.今回起きた事象

discord.pyを使ってdiscordのBOTを作成し終わったので、herokuにデプロイしてみるかーと思い、「git push heroku master」とコマンドを叩いたところ以下のエラーが…

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

上のエラーメッセージで調べると、実際にあげようとしているアプリの言語とherokuのアプリに設定されているbuildpackが異なると出てくるなんて記事がいくつか見つかった。

ただ、今回herokuのbuildpackもgit pushしたアプリの言語もpythonであっている…

2.原因と解決

とりあえずherokuの公式ドキュメント見てみるかーと思ってみたらなんと…

ルートフォルダに「requirements.txt」と「Procfile」ってものを置いておかなければならないらしいので以下のように作成

requirement.txt
discord.py==1.2.3
bot: python main.py

requirement.txtには依存関係のあるものを書かなければいけないようで、
「依存関係にあるファイル==そのバージョン」
という形で記載をしていけばよいらしい

Procfileは拡張子はいらなくて、そのアプリケーションを起動する際のコマンドを記載する必要があるとのこと

便利なものって最初使うときはハマるもんだなと思いましたとさ

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2