Django Ckeditor image not showing after 1 hour in production with amazon s3 bucket

188 Views Asked by At

Django ckeditor image shows perfectly on local machine but not display in production with s3 bucket after 1 hour. Make s3 bucket public. But didn't solve yet. Settings are

DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'



AWS_ACCESS_KEY_ID = env('AWS_ACCESS_KEY_ID')
AWS_SECRET_ACCESS_KEY = env('AWS_SECRET_ACCESS_KEY')
AWS_STORAGE_BUCKET_NAME = env('AWS_STORAGE_BUCKET_NAME')
AWS_S3_REGION_NAME = env('AWS_S3_REGION_NAME')
AWS_QUERYSTRING_AUTH = False
AWS_QUERYSTRING_EXPIRE = int(env('AWS_QUERYSTRING_EXPIRE'))  # for 10 years in seconds
AWS_DEFAULT_ACL = 'public-read'

after disappering the image when I hit the url it shows the error

This XML file does not appear to have any style information associated with it. The document tree is shown below.
<Error>
<Code>AccessDenied</Code>
<Message>Request has expired</Message>
<Expires>2022-04-11T04:17:03Z</Expires>
<ServerTime>2022-04-11T04:33:34Z</ServerTime>
<RequestId>65579SD4M8QA0RCB</RequestId>
<HostId>o4HzVND3mA0yt6oULNSXeceP1ALOTHPfToDD/I0XH+W/t9zuYRQAfdG29o+QZt8wsNaidDlnaCY=</HostId>
</Error>

and on cosole it shows the error also

GET https://cntestbucket.s3.amazonaws.com/pranta/2022/04/11/1_zcvrri69ovmke7xgulw8ow.png?AWSAccessKeyId=AKIAYR5JG2JQDGCDJ77A&Signature=UjF9Fnr28v%2FjX3sEmbGGV8%2FsK10%3D&Expires=1649650623 403 (Forbidden)

0

There are 0 best solutions below