wsgi 在 ec2 上运行烧瓶应用程序:boto3 返回“Boto3 错误:botocore.exceptions.NoCredentialsError...”

时间:2021-02-09 18:08:46

标签: python-3.x flask amazon-ec2 boto3 wsgi

我正在 ec2 上使用 wsgi 部署一个 Flask 应用程序。应用程序使用 boto3 使用 SES 发送电子邮件。当我在开发模式下运行 Fask 应用程序时,一切正常,即,仅作为 python app.py 运行。 (我也在使用虚拟环境)。

当我在同一个实例上通过 wsgi 部署它时出现问题。 boto3 无法加载凭据,返回 Boto3 Error: botocore.exceptions.NoCredentialsError 。我没有在 boto3 中明确配置任何凭证/密钥文件,因为如果 boto3 中没有提到配置,boto3 将自动使用实例配置文件角色(并且它在手动运行 Flask 应用程序时测试了工作)。我应该怎么做才能使它在使用 wsgi 运行时也使用默认的 ec2 凭据?

注意:Python 3.6 版

0 个答案:

没有答案
相关问题