django-storages-s3
What it does
It guides the AI agent to set up file storage for Django on AWS S3 using django-storages. It is for developers who want uploaded files and static assets kept in the cloud.
When to use it
- βWhen you want Django static and media files served from an S3 bucket.
- βWhen you need private files shared through presigned download links.
- βWhen you want to move existing file uploads to S3 without rewriting your code.
Skill link
https://github.com/Jeffallan/claude-skills/blob/main/skills/django-storages-s3/SKILL.mdCopy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.
How to use
The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.
Ready-to-paste message
For Claude Code, Codex or Cursor: run it in your project folder and the skill gets installed.
Download the SKILL.md and drop it into your agentβs skills folder.
Example of what to ask your AI
βMove my Django user uploads and static files to an S3 bucket, with private files behind signed links.β
5 new skills a week. 1 minute to read.
How it works
The agent installs the packages, sets the credentials and the STORAGES settings, and separates public from private storage. It then checks the uploads and tests with mock storage.
Technical content (original SKILL.md)
Original text by the author, straight from GitHub.
Django Storages S3
Senior Django specialist for production-grade file storage on AWS S3 via django-storages and boto3 β public and private media, static files, presigned URLs, and CloudFront.
When to Use This Skill
- Serving static and/or media files from AWS S3 instead of the local filesystem
- Configuring the Django 4.2+
STORAGESdict or legacyDEFAULT_FILE_STORAGE - Separating public (CDN-served) and private (presigned) file backends
- Generating presigned download or direct browser-to-S3 upload URLs
- Fronting S3 with CloudFront and writing a least-privilege IAM policy
- Migrating local
FileField/ImageFieldstorage to S3 without code changes - Testing storage code without hitting S3
Core Workflow
- Install & register β
pip install django-storages[s3] boto3; add"storages"toINSTALLED_APPS - Configure credentials β Load from env vars or rely on an attached IAM role; never hardcode
- Wire the
STORAGESdict β Setdefault(media) andstaticfilesbackends with separatelocationprefixes - Add named backends β Split public vs. private buckets/ACLs as additional
STORAGESentries when needed - Verify & test β Run
collectstatic, confirm uploads land in S3, and mock S3 in tests withInMemoryStorageormoto
Reference Guide
Load detailed guidance based on context:
| Topic | Reference | Load When |
|---|---|---|
| Settings & STORAGES | references/configuration.md |
Core settings, 4.2+ vs legacy, CloudFront |
| Custom backends | references/custom-backends.md |
Public vs. private buckets, per-field storage |
| Presigned URLs | references/presigned-urls.md |
Download links, direct browser uploads |
| Testing & IAM | references/testing-storages.md |
Mocking S3, IAM policy, common pitfalls |
Minimal Working Example
The snippet below demonstrates the core MUST DO constraints: env-loaded credentials, STORAGES dict, separate media/static locations, and default_acl=None on the media backend.
# settings.py
import os
AWS_STORAGE_BUCKET_NAME = os.environ["AWS_STORAGE_BUCKET_NAME"]
AWS_S3_REGION_NAME = os.environ.get("AWS_S3_REGION_NAME", "us-east-1")
AWS_S3_CUSTOM_DOMAIN = f"{AWS_STORAGE_BUCKET_NAME}.s3.{AWS_S3_REGION_NAME}.amazonaws.com"
# On EC2/ECS/Lambda, omit keys entirely β boto3 uses the attached IAM role.
STORAGES = {
"default": { # media uploads
"BACKEND": "storages.backends.s3boto3.S3Boto3Storage",
"OPTIONS": {
"bucket_name": AWS_STORAGE_BUCKET_NAME,
"location": "media",
"default_acl": None, # rely on bucket policy, not per-object ACLs
"file_overwrite": False,
"querystring_auth": False, # public objects β clean URLs
},
},
"staticfiles": {
"BACKEND": "storages.backends.s3boto3.S3StaticStorage",
"OPTIONS": {
"bucket_name": AWS_STORAGE_BUCKET_NAME,
"location": "static",
},
},
}
MEDIA_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/media/"
STATIC_URL = f"https://{AWS_S3_CUSTOM_DOMAIN}/static/"
# models.py β uploads go straight to S3 on save()
from django.db import models
class Document(models.Model):
file = models.FileField(upload_to="docs/") # uses STORAGES["default"]
Auditing an Existing Configuration
When reviewing a project that already uses S3 (not greenfield), walk this checklist β each item is a constraint below rephrased as "find X, confirm Y":
- Credentials β
grep -rn "AWS_SECRET_ACCESS_KEY\|aws_secret" settings/β confirm values come fromos.environ/django-environor an IAM role, never literals committed to the repo. - ACLs β
grep -rn "default_acl\|AWS_DEFAULT_ACL" .β on buckets created after April 2023, every value must beNone. Any"public-read"/"private"will raiseAccessControlListNotSupported; public access belongs in a bucket policy. - Storage backend β confirm Django 4.2+ uses the
STORAGESdict, notDEFAULT_FILE_STORAGE/STATICFILES_STORAGE(removed in Django 5.1, so silently ignored on 5.1/5.2/6.0); confirm the static class isS3StaticStorage, not a fabricated name. - Locations β confirm
default(media) andstaticfileshave distinctlocationprefixes or buckets socollectstaticnever collides with uploads. - Region β confirm
region_name(or the globalAWS_S3_REGION_NAME) matches the bucket's real region and thatAWS_S3_CUSTOM_DOMAINincludes the reg
FAQ
Does it need AWS credentials?
Yes. It loads them from environment variables or an attached IAM role, and never hardcodes them.
Does it support CloudFront?
Yes. It covers placing CloudFront in front of S3.
How are tests handled?
It mocks S3 in tests with in-memory storage or moto, so tests do not reach real S3.
Details
Original description by the author
Use when configuring Django to store static and media files on AWS S3 with django-storages. Invoke when working with the STORAGES setting, S3 buckets, presigned URLs, CloudFront, or boto3-backed file storage in settings.py. Configures the Django 4.2+ STORAGES dict, public/private custom backends, presigned GET/POST URLs, IAM policies, and S3 mocking for tests. Trigger terms: django-storages, S3, boto3, S3Boto3Storage, STORAGES, presigned URL, CloudFront, media files, collectstatic, AWS_STORAGE_BUCKET_NAME.
repo: Jeffallan/claude-skills
Popularity
- GitHub stars
- 12k
- Ranking position
- #11419
- License
- MIT
- Updated
- 10/30/2026
Comments
- β¦
More skills from this repository
angular-architect
12kHelps your agent build Angular 17 and newer apps with standalone components, lazy-loaded routing, NgRx state, RxJS patterns, and performance tuning.
api-designer
12kHelps your agent design REST or GraphQL APIs and write OpenAPI 3.1 specs, with rules for resources, pagination, error formats, and versioning.
architecture-designer
12kHelps your agent design system architecture, compare patterns and technologies, and write Architecture Decision Records that explain each choice.
atlassian-mcp
12kHelps your agent search and update Jira issues and Confluence pages through MCP, including JQL and CQL queries, sprints, and documentation sync.
Similar skills
api-connector-builder
280kHas your agent build new API connections following the existing pattern. Use when you need to add one more integration without creating a new way of doing things.
api-design
280kHelps your agent design REST APIs following best practices. It's useful for defining how APIs communicate, how errors are shown, and how to organize data.
backend-patterns
280kHelps your agent with server-side architecture patterns and database optimization. It's useful for building or reviewing code that runs on the server.