Serving static files from google cloud storage?

前端 未结 2 1583
轮回少年
轮回少年 2020-12-10 06:54

I wanted to serve static files stored in google cloud storage for app hosted in app engine. In HTML file, I used



        
2条回答
  •  隐瞒了意图╮
    2020-12-10 07:50

    Beside of manually change each of the static files through Google Cloud Storage Manager you can also set your bucket to be publically viewable using gsutil:

    Use acl to set public-read on current bucket objects

    gsutil -m acl set -R -a public-read gs://BUCKET_NAME
    

    Use defacl to set as default for future uploads:

    gsutil -m defacl set public-read gs://BUCKET_NAME
    

    The "shared publicly" check box will be then automatically checked for every files uploaded.

    For accessing bucket, make sure that you have enter an authorized id or email for the groups and users and a domain for the bucket permission otherwise you will get error message like:

    'DefAclCommand' object has no attribute 'continue_on_error'
    

    You can do also in Console or Using IAM roles.

提交回复
热议问题