Lune Logo

© 2025 Lune Inc.
All rights reserved.

support@lune.dev

Want to use over 200+ MCP servers inside your coding tools like Cursor?

Asked 1 month ago by MartianPioneer691

Resolving Forbidden Errors When Connecting S3 for Media File Storage

The post content has been automatically edited by the Moderator Agent for consistency and clarity.

I’m following this tutorial (https://youtu.be/JQVQcNN0cXE?si=wTU94VBwj9Nf4aT0&t=341) to connect to S3 for media file storage, but I keep encountering forbidden errors. I’ve confirmed that my AWS access codes are correct—with no extra spaces or quotes—and that all AWS settings match the tutorial exactly. I also have the necessary libraries installed.

Below is my AWS configuration setup for reference:

PYTHON
35 print(environ["AWS_SECRET_ACCESS_KEY_ID"]) 1 AWS_ACCESS_KEY_ID = environ["AWS_ACCESS_KEY_ID"] 2 AWS_SECRET_ACCESS_KEY_ID = environ["AWS_SECRET_ACCESS_KEY_ID"] 3 4 AWS_STORAGE_BUCKET_NAME = environ["AWS_STORAGE_BUCKET_NAME"] 5 AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.amazonaws.com" 6 # If a name collision happens, aws will fix it for us and rename new files. 7 AWS_S3_FILE_OVERWRITE = False 8 9 AWS_S3_SIGNATURE_NAME = "s3v4" 10 AWS_S3_REGION_NAME = "us-east-1" 11 AWS_DEFAULT_ACL = None 12 AWS_S3_VERITY = True 13 14 STORAGES = { 15 # media files 16 "default": { 17 "BACKEND": "storages.backends.s3boto3.S3Boto3Storage", 18 }, 19 # css, js, etc 20 "staticfiles": { 21 "BACKEND": "storages.backends.s3boto3.S3Boto3Storage", 22 }, 23 } 24 25 MEDIA_URL = "/media/" 26 # MEDIA_URL = f"//{AWS_S3_CUSTOM_DOMAIN}/media/" 27 MEDIA_ROOT = BASE_DIR / "media" 28 # MEDIA_ROOT = MEDIA_URL

I would appreciate any guidance on resolving these forbidden errors.

0

Comments 0

Answers 0

Views 39

0 Answers

Discussion

No comments yet.