Image uploading on GCS in my local work properly. After deploy django prject on vm instance with load balancer, setup ssl and domain name gives error of access denied.
Forbidden at /admin/products/banner/add/
403 POST https://storage.googleapis.com/upload/storage/v1/b/new_zourie_app/o?uploadType=multipart: {
"error": {
"code": 403,
"message": "Access denied.",
"errors": [
{
"message": "Access denied.",
"domain": "global",
"reason": "forbidden"
}
]
}
}
: ('Request failed with status code', 403, 'Expected one of', <HTTPStatus.OK: 200>)
I have added multiple (like allUsers, Storage admin, Storage Object Creator, Storage Object Admin) permissions to that bucket as given in google cloud platform docs. Also updated the bucket and bucket keys in the local as well on vm instance as a result it works on locally but not on production which have uploaded on gcp.
This is because by default VM instance service account have read-only access scope to storage bucket. you have to change scope to read-write with below steps.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.