-
-
Notifications
You must be signed in to change notification settings - Fork 867
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
S3 is broken #1361
Comments
same exact issue. this only occurs for django admin staticfiles. other staticfiles like swagger-ui and debugtoolbar are working
STORAGES = {
"default": {
"BACKEND": "storages.backends.s3.S3Storage",
"OPTIONS": {
"access_key": os.environ["AWS_S3_ACCESS_KEY_ID"],
"secret_key": os.environ["AWS_S3_SECRET_ACCESS_KEY"],
"bucket_name": os.environ["AWS_STORAGE_BUCKET_NAME"],
"region_name": os.environ["AWS_S3_REGION_NAME"],
"custom_domain": f"{os.environ['AWS_S3_CUSTOM_DOMAIN']}",
"cloudfront_key": os.environ["AWS_CLOUDFRONT_KEY"].encode("ascii").strip(),
"cloudfront_key_id": os.environ["AWS_CLOUDFRONT_KEY_ID"].strip(),
"signature_version": "s3v4",
"location": "dev/media/",
},
},
"staticfiles": {
"BACKEND": "storages.backends.s3.S3StaticStorage",
"OPTIONS": {
"access_key": os.environ["AWS_S3_ACCESS_KEY_ID"],
"secret_key": os.environ["AWS_S3_SECRET_ACCESS_KEY"],
"bucket_name": os.environ["AWS_STORAGE_BUCKET_NAME"],
"region_name": os.environ["AWS_S3_REGION_NAME"],
"custom_domain": f"{os.environ['AWS_S3_CUSTOM_DOMAIN_PUBLIC']}",
"cloudfront_key": os.environ["AWS_CLOUDFRONT_KEY"].encode("ascii").strip(),
"cloudfront_key_id": os.environ["AWS_CLOUDFRONT_KEY_ID"].strip(),
"signature_version": "s3v4",
"location": "prod/static/",
"querystring_auth": False,
"default_acl": "public-read",
"querystring_expire": 604800,
},
},
}
STATIC_URL = f"https://{os.environ['AWS_S3_CUSTOM_DOMAIN_PUBLIC']}/prod/static/"
MEDIA_URL = f"https://{os.environ['AWS_S3_CUSTOM_DOMAIN']}/dev/media/" anyone found a workaround? |
Apologies the fix is in #1336 I simply haven't released it due to life and the like. |
The second comment here where the other staticfiles do not work does seem like some kind of upstream regression. Do you have https://github.com/django/django/blob/main/django/templatetags/static.py#L126-L129 |
Let's assume following django settings where all the env variables are properly set:
S3 doesn't work there I do get the following exception:
I tried to put a debug into
/boto3/resources/base.py
right before the line which raises the exception which is:The function is called many times and
self.meta.identifiers
has sometimes some sometimes none parameters. But on it's like 4th call theself.meta.identifiers
equals["name"]
but the variable is not set underself.itentifier
object. One of the previous calls the property is there and corresponds toSTORAGES
django settings. But not on it's 4th call.I assume this is not boto3 library error as long as the old approach with django settings
AWS_S3_*
variables works.The text was updated successfully, but these errors were encountered: