Issue
I'm trying to use Amazon s3 for file storage but when I try to upload file in to a s3 bucket it throws me an error:
ClientError at /admin/myschool/secondary/add/
An error occurred (InvalidArgument) when calling the PutObject operation: None
when i try to run python manage.py collectstatic :
File "C:\Users\ADAMUDEE\AppData\Local\Programs\Python\Python310\lib\site-packages\botocore\client.py", line 745, in _make_api_call
raise error_class(parsed_response, operation_name)
botocore.exceptions.ClientError: An error occurred (InvalidArgument) when calling the PutObject operation: None.
even in my admin panel.
i have setup everything as you can see here in my settings.py file:
AWS_ACCESS_KEY_ID = ''
AWS_SECRET_ACCESS_KEY ''
AWS_STORAGE_BUCKET_NAME ''
AWS_S3_FILE_OVERWRITE = 'False'
AWS_DEFAULT_ACL = 'None'
DEFAULT_FILE_STORAGE = 'storages.backends.s3boto3.S3Boto3Storage'
Solution
I have solved my problem by genarating public access policy i also set my AWS_DEFAULT_ACL = 'public-read' and run collectstatic its shows me an error Could not connect to the endpoint URL: so i solve that in here when you are done then come back to bucket you will see Only authorized users of this account once you see that then you can go ahead and run collectstatic again and then You are welcome.
Answered By - Adamu Abdulkarim
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.