Custom Django storage backend for AWS S3 using boto3
Project description
🌐 django-s3-aws
django-s3-aws is a Django storage backend that integrates Amazon S3 in a simple way to manage static and media files.
It includes support for presigned URLs, ACLs, and secure access to private buckets.
✨ Features
- 🔹 Compatible with Django 3.2+ and 4.0+
- 🔹 Direct integration with Amazon S3 using
boto3 - 🔹 Generate presigned URLs for secure downloads
- 🔹 Minimal configuration: you only need the bucket name
- 🔹 Built-in defaults handled inside the library (
src/django_s3_aws/settings.py)
⚙️ Installation
pip install django-s3-aws
Then add the library to your project:
# settings.py
INSTALLED_APPS = [
...
"django_s3_aws",
]
Configuration in settings.py
AWS_STORAGE_BUCKET_NAME = "my-bucket" AWS_REGION = "us-east-1"
Optional (if you are not using IAM Roles in AWS)
AWS_ACCESS_KEY_ID = "my-access-key" AWS_SECRET_ACCESS_KEY = "my-secret-key"
DEFAULT_FILE_STORAGE = "django_s3_aws.storage.S3AWSStorage"
Basic Usage
from django.core.files.base import ContentFile from django_s3_aws.storage import S3AWSStorage
storage = S3AWSStorage()
Save a file
storage.save("example.txt", ContentFile(b"Hello from S3!"))
Generate a public or presigned URL
print(storage.url("example.txt")) print(storage.generate_presigned_url("example.txt", expiration=600))
Roadmap
Full integration with moto3 for mocking S3 in tests
Compatibility with django-storages API
Support for advanced configurations (versioning, SSE, etc.)
License
django-s3-aws is licensed under the MIT License.
Contacto
LinkedIn hugo aragon
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_s3_aws-1.0.2.tar.gz.
File metadata
- Download URL: django_s3_aws-1.0.2.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0cae5a900cc6ac308fec872d382a3efa41d2a6e7711d8486784d545ecc67e46
|
|
| MD5 |
d37434ca0f5bd0b8942226c0a3666b98
|
|
| BLAKE2b-256 |
4e8c86e44dabeac13e4d59d5ef7a46536cabde2f14b8c1a5180cacee922b90ef
|
File details
Details for the file django_s3_aws-1.0.2-py3-none-any.whl.
File metadata
- Download URL: django_s3_aws-1.0.2-py3-none-any.whl
- Upload date:
- Size: 6.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9843547adbffb6625166283920b8a715e720ec75c570f6b97ebc3ae4464b0ef
|
|
| MD5 |
b43ad4a8e032e35b0d08c4b16f8f290c
|
|
| BLAKE2b-256 |
2733132001c0891d6a8c1084021d3ec529569216f52cbf675bfe09484b74284e
|