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

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

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

FlaskはPython用のマイクロフレームワークであり、Werkzeug・Jinja 2・good intentionsをベースにしています。

Heroku

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

Python

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

Q&A

0回答

690閲覧

pythonでアプリをherokuにデプロイできません。

tokairyu

総合スコア2

Flask

FlaskはPython用のマイクロフレームワークであり、Werkzeug・Jinja 2・good intentionsをベースにしています。

Heroku

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

Python

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

0グッド

0クリップ

投稿2020/10/20 02:58

前提・実現したいこと

こんにちは、LINEBOTをpythonで作ってherokuにデプロイしようとしているのですが、うまくいきません。buildpackが原因かと思い、様々変更してみましたがエラーになってしまいました。
全くわからなくなってしまったので、お力添えいただけると大変助かります。

発生している問題・エラーメッセージ

Enumerating objects: 29, done.
Counting objects: 100% (29/29), done.
Delta compression using up to 4 threads
Compressing objects: 100% (24/24), done.
Writing objects: 100% (29/29), 5.98 KiB | 1.50 MiB/s, done.
Total 29 (delta 12), reused 0 (delta 0)
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: !
remote: ! ## Warning - The same version of this code has already been built: 6df03be8d6f9f44669c52e13888fbf68d346d1fe
remote: !
remote: ! We have detected that you have triggered a build from source code with version 6df03be8d6f9f44669c52e13888fbf68d346d1fe
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 h100713bot2.
remote:
To https://git.heroku.com/h100713bot2.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/h100713bot2.git'```
エラーメッセージ

python from flask import Flask, request, abort import os from linebot import ( LineBotApi, WebhookHandler ) from linebot.exceptions import ( InvalidSignatureError ) from linebot.models import ( MessageEvent, TextMessage, TextSendMessage, ) app = Flask(__name__) #環境変数取得 YOUR_CHANNEL_ACCESS_TOKEN ="59Da4rrpknIEdovs8OEdomymGv3ieg/UibOyGyZc+qSCQVSbK9U3g8vcs7/qOQRDjibZL/YQinfXFWnaT0uMRaK6lGF4JLnTgJSQCDXoUUBhi+gGz27PWjc6j/c7N0EMpI1vlvyzpP+m3/zx/VLElAdB04t89/1O/w1cDnyilFU=" YOUR_CHANNEL_SECRET = "dc6b6707e1725f1b5ca7014497ef2c7b" line_bot_api = LineBotApi(YOUR_CHANNEL_ACCESS_TOKEN) handler = WebhookHandler(YOUR_CHANNEL_SECRET) @app.route("/") def hello_world(): return "hello world!" @app.route("/callback", methods=['POST']) def callback(): # get X-Line-Signature header value signature = request.headers['X-Line-Signature'] # get request body as text body = request.get_data(as_text=True) app.logger.info("Request body: " + body) # handle webhook body try: handler.handle(body, signature) except InvalidSignatureError: abort(400) return 'OK' @handler.add(MessageEvent, message=TextMessage) def handle_message(event): if event.message.text =="thx": reply="your welcome" else: reply="f you said {event.message.text}" line_bot_api.reply_message( event.reply_token, TextSendMessage(text=reply)) if __name__ == "__main__": # app.run() port = int(os.getenv("PORT")) app.run(host="0.0.0.0", port=port)

以下buidpackです
requirements.txt

appnope==0.1.0
async-generator==1.10
backcall==0.2.0
certifi==2020.6.20
chardet==3.0.4
click==7.1.2
decorator==4.4.2
defusedxml==0.6.0
entrypoints==0.3
Flask==1.1.2
future==0.18.2
gunicorn==20.0.4
idna==2.10
ipython-genutils==0.2.0
itsdangerous==1.1.0
Jinja2==2.11.2
jupyter==1.0.0
jupyter-core==4.6.3
line-bot-sdk==1.17.0
MarkupSafe==1.1.1
mistune==0.8.4
packaging==20.4
pandocfilters==1.4.2
parso==0.7.0
pexpect==4.8.0
pickleshare==0.7.5
prometheus-client==0.8.0
ptyprocess==0.6.0
pyparsing==2.4.7
python-dateutil==2.8.1
pyzmq==19.0.2
QtPy==1.9.0
requests==2.24.0
Send2Trash==1.5.0
six==1.15.0
terminado==0.9.1
testpath==0.4.4
tornado==6.0.4
traitlets==4.3.3
urllib3==1.25.10
webencodings==0.5.1
Werkzeug==1.0.1
widgetsnbextension==3.5.1

Procfile
web: gunicorn app:app --log-file -

Runtime.txt
Python-3.6.12

試したこと

requirements.txtを pip freeze > requirements.txt で再度作りました、中にライブラリのバージョン以外のURLが書いてあり、エラーが発生していると思われたので、削除しましたが、失敗しました。
procfileの中身をいじってみたりしました。
git pull などのコマンドを試してみました。
スペルミスなどないかチェックしました

補足情報(FW/ツールのバージョンなど)

ここにより詳細な情報を記載してください。

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

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

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

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

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

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問