简体   繁体   English

AWS凭证:无法在Django Python中找到凭证

[英]AWS credentials : unable to locate credentials in django python

I have configured credentials using aws configure. 我已经使用aws configure配置了凭据。 aws configure list looks fine.Python/django is able to locate the credentials in the shell_plus but unable to locate credentials when django is being run through gunicorn / supervisor. aws configure列表看起来不错。Python/ django能够在shell_plus中找到凭据,但是当通过gunicorn / supervisor运行django时无法找到凭据。

This is weired 这很奇怪

When you run aws configure you will write files linked to your profile as they will be written in ~/.aws/config and ~/.aws/credentials. 运行aws configure时,您将写入链接到您的配置文件的文件,因为它们将被写入〜/ .aws / config和〜/ .aws / credentials。

When you run your application, the application will look for those files using the same logic, ie.~/.aws/credentials. 当您运行应用程序时,应用程序将使用相同的逻辑(即〜/ .aws / credentials)查找那些文件。

When in a shell, the interpreter will try to translate ~ to an absolute path based on $(whoami). 在外壳程序中时,解释器将尝试将〜转换为基于$(whoami)的绝对路径。

TL;DR - You must run aws configure with the same user as your application is running with. TL; DR-您必须使用与运行应用程序相同的用户来运行aws configure。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM