概要
Elastic Beanstalkでflaskを実装しようとしたら
application
が見つからないというエラーが出た
ログ
----------------------------------------
/var/log/web.stdout.log
----------------------------------------
(省略)
Nov 28 05:46:30 ip-172-31-24-160 web[4572]: Failed to find attribute 'application' in 'application'.
Nov 28 05:46:30 ip-172-31-24-160 web[4572]: [2023-11-28 05:46:30 +0000] [4572] [INFO] Worker exiting (pid: 4572)
Nov 28 05:46:30 ip-172-31-24-160 web[4568]: [2023-11-28 05:46:30 +0000] [4568] [ERROR] Worker (pid:4572) exited with code 4
Nov 28 05:46:30 ip-172-31-24-160 web[4568]: [2023-11-28 05:46:30 +0000] [4568] [ERROR] Shutting down: Master
Nov 28 05:46:30 ip-172-31-24-160 web[4568]: [2023-11-28 05:46:30 +0000] [4568] [ERROR] Reason: App failed to load.
解決方法
コード内のapp
をapplication
に変えるだけだった
from flask import Flask
# 変更前
- app = Flask(__name__)
- @app.route("/callback", methods=['POST'])
# 省略
# 変更後
+ application = Flask(__name__)
+ @application.route("/callback", methods=['POST'])
# 省略