前提・実現したいこと
LINEのAPIを使って、通知アプリを作り、定期的に実行したいため、herokuにデプロイしようとしたら、エラーが発生しました。
自分で色々調べてみましたが、解決できなかったため、
分かる方がいれば、ご教授頂きたいです。
発生している問題・エラーメッセージ
Enumerating objects: 5, done. Counting objects: 100% (5/5), done. Delta compression using up to 4 threads Compressing objects: 100% (3/3), done. Writing objects: 100% (5/5), 726 bytes | 726.00 KiB/s, done. Total 5 (delta 0), reused 0 (delta 0) remote: Compressing source files... done. remote: Building source: remote: remote: -----> Building on the Heroku-20 stack remote: -----> Determining which buildpack to use for this app remote: -----> Python app detected remote: -----> Using Python version specified in runtime.txt remote: ! Requested runtime (python-3.7.5) is not available for this stack (heroku-20). remote: ! Aborting. More info: https://devcenter.heroku.com/articles/python-support remote: ! Push rejected, failed to compile Python app. remote: remote: ! Push failed remote: ! remote: ! ## Warning - The same version of this code has already been built: bfda067c2b1a86ca39130750127d10ddbf661901 remote: ! remote: ! We have detected that you have triggered a build from source code with version bfda067c2b1a86ca39130750127d10ddbf661901 remote: ! at least twice. One common cause of this behavior is attempting to deploy code from a different branch. remote: ! remote: ! If you are developing on a branch and deploying via git you must run: remote: ! remote: ! git push heroku <branchname>:main remote: ! remote: ! This article goes into details on the behavior: remote: ! https://devcenter.heroku.com/articles/duplicate-build-version remote: remote: Verifying deploy... remote: remote: ! Push rejected to radiant-inlet-54200. remote: To https://git.heroku.com/radiant-inlet-54200.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/radiant-inlet-54200.git'
該当のソースコード
notification.py
python
1from __future__ import absolute_import, unicode_literals 2import requests 3import os 4 5# 環境変数(.bash_profile)に設定されているLINEのトークンを取得 6LINE_ACCESS_TOKEN = os.environ.get('LINE_ACCESS_TOKEN') 7 8headers = {"Authorization": f"Bearer {LINE_ACCESS_TOKEN}"} 9 10data = {"message": "テストでメッセージ送るよ~"} 11 12requests.post("https://notify-api.line.me/api/notify", 13 headers=headers, 14 data=data)
requirements.txt
requests==2.24.0
runtime.txt
python-3.7.5
ターミナルで実行したこと
1.$ heroku login
2.$ heroku create
3.$ git init
4.$ git remote add heroku https://git.heroku.com/radiant-inlet-54200.git
5.$ git add .
6.$ git commit -m "first commit"
7.$ git push heroku master
↓
エラーメッセージ発生
補足情報(FW/ツールのバージョンなど)
python 3.7.5
heroku: heroku/7.35.0 darwin-x64 node-v12.13.0
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/05/24 22:10