質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.50%
Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

Q&A

解決済

1回答

3699閲覧

herokuにデプロイする際に、エラーがでてしまう

massu39

総合スコア1

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Python 3.x

Python 3はPythonプログラミング言語の最新バージョンであり、2008年12月3日にリリースされました。

Python

Pythonは、コードの読みやすさが特徴的なプログラミング言語の1つです。 強い型付け、動的型付けに対応しており、後方互換性がないバージョン2系とバージョン3系が使用されています。 商用製品の開発にも無料で使用でき、OSだけでなく仮想環境にも対応。Unicodeによる文字列操作をサポートしているため、日本語処理も標準で可能です。

0グッド

0クリップ

投稿2021/05/23 05:10

前提・実現したいこと

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

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

エラーメッセージに原因が記載されています。

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.

ランタイムは python-3.7.5 要求しましたが、heroku はこのバージョンをサポートしていません。
以下のいずれかのバージョンを使用してください。

python-3.9.5 on all supported stacks
python-3.8.10 on all supported stacks
python-3.7.10 on all supported stacks
python-3.6.13 on all supported stacks

投稿2021/05/23 08:37

nskydiving

総合スコア6500

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

massu39

2021/05/24 22:10

解決しました。 ありがとうございます。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.50%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問