rpr*_*sad 2 django google-cloud-storage google-compute-engine
对于 django-storages 和 google 计算引擎 (GCE),如何为 Web 应用程序创建和设置凭据?
这是当前文档:http://django-storages.readthedocs.io/en/latest/backends/gcloud.html
为了节省其他人的时间,我重新发布了dresdesmet、sww314和manufont添加到 2 个单独的 github 问题中的答案
第 1 步(干法)
pip install google-cloud-storage
步骤 2 (sww314)
请按照此处的步骤 1、2 和可选的步骤 4(不是步骤 3)进行操作:
https://github.com/jschneier/django-storages/issues/455#issuecomment-360288072
步骤3。(制造商)
代替:
GS_CREDENTIALS = "path/to/credentials.json"
Run Code Online (Sandbox Code Playgroud)
做这个:
from google.oauth2 import service_account
GS_CREDENTIALS = service_account.Credentials.from_service_account_file(
"path/to/credentials.json"
)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
887 次 |
| 最近记录: |