django-storages-s3

Configures Django to store static and media files on AWS S3 with django-storages.

11.3k|1.1k|Updated Oct 20, 2025
One-click install
npx skills add https://github.com/Jeffallan/claude-skills --skill django-storages-s3
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: django-storages-s3
Source: https://github.com/Jeffallan/claude-skills/tree/main/skills/django-storages-s3
Command: npx skills add https://github.com/Jeffallan/claude-skills --skill django-storages-s3

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires django-storages, boto3, moto, and includes references (resource) components.

What problem does it solve?

Moving Django file uploads and static assets off the local filesystem onto AWS S3 involves many subtle settings — the STORAGES dict, ACLs, presigned URLs, IAM policies — and misconfigurations cause silent failures like broken links, leaked files, or AccessControlListNotSupported errors.

Core Features & Use Cases

  • STORAGES Configuration: Sets up the Django 4.2+ STORAGES dict with separate media and static backends, plus legacy settings for older Django versions.
  • Public/Private Backends: Splits storage into CDN-served public buckets and private backends that issue presigned GET/POST URLs for secure downloads and direct browser-to-S3 uploads.
  • Testing & IAM Guidance: Mocks S3 in tests with InMemoryStorage or moto and provides a least-privilege IAM policy.
  • Use Case: You need user-uploaded contracts served only through time-limited presigned URLs while public images go through CloudFront — this Skill configures both backends and flags the custom_domain conflict that breaks presigning.

Quick Start

Ask the AI to configure your Django project to store media and static files on AWS S3 using django-storages with separate public and private backends.

Frequently Asked Questions about django-storages-s3

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure Django to store media files on AWS S3?

Install django-storages[s3] and boto3, add "storages" to INSTALLED_APPS, then define the STORAGES dict with S3Boto3Storage as the default backend. Load credentials from environment variables or an IAM role, and set separate location prefixes for media and static files.

How do I generate presigned URLs for private S3 files in Django?

Set querystring_auth=True and custom_domain=None on the private backend, then calling .url on a file field returns a presigned GET URL automatically. For direct browser uploads, use boto3's generate_presigned_post to let clients upload straight to S3.

Does django-storages work with Django 5 and 6?

Yes, the STORAGES dict introduced in Django 4.2 works unchanged through Django 5.2 LTS and 6.0. The legacy DEFAULT_FILE_STORAGE and STATICFILES_STORAGE settings were removed in Django 5.1 and are silently ignored there.

Why do I get AccessControlListNotSupported when uploading to S3?

Buckets created after April 2023 have ACLs disabled by default, so any default_acl value other than None raises this error. Set default_acl=None and control public access through a bucket policy instead of per-object ACLs.

How do I test Django file uploads without hitting real S3?

Use override_settings to swap the STORAGES default backend to InMemoryStorage so tests never touch AWS. When code calls boto3 directly, such as for presigned URLs, mock the S3 API with the moto library instead.

Why do my presigned S3 URLs return 403 errors?

Common causes are setting custom_domain alongside querystring_auth, server clock skew, signing for the wrong region, or caching a presigned URL past its AWS_QUERYSTRING_EXPIRE lifetime. Set custom_domain=None and generate URLs per request.