交互我有一個瓶的應用程序看起來像這樣:部署瓶應用通過彈性魔豆與S3
from flask import Flask
import boto3
application = Flask(__name__)
@application.route("/")
def home():
return "Server successfully loaded"
@application.route("/app")
def frontend_from_aws():
s3 = boto3.resource("s3")
frontend = s3.Object(bucket_name = "my_bucket", key = "frontend.html")
return frontend.get()["Body"].read()
if __name__ == "__main__":
application.debug = True
application.run()
一切完美的作品時,我在本地測試,但是當我的應用程序部署到彈性魔豆第二端點給出了一個內部服務器錯誤:
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
我沒看到什麼驚人的記錄,雖然我不能完全肯定我會知道去哪裏找。有任何想法嗎?
更新:作爲一個測試,我frontend.html移動到不同的水桶,並相應修改了「/應用」端點,而神祕它能正常工作。顯然這與原始存儲桶的設置有關。有人知道正確的設置可能是什麼嗎?
大約一年前,我創建了我的Elastic Beanstalk實例和另一個S3存儲桶(應用程序在其上工作),但我不記得我做了什麼配置。你有沒有參考資料可以解釋需要做什麼? –