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](https://www.linkedin.com/in/hugo345?utm_source=share&utm_campaign=share_via&utm_content=profile&utm_medium=android_app) 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
django_s3_aws-1.0.0.tar.gz
(5.8 kB
view details)
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.0.tar.gz.
File metadata
- Download URL: django_s3_aws-1.0.0.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 |
96c40f522819ad89bb0859bd3feee88541017cb8b832cbe97001700a35f7f79c
|
|
| MD5 |
aa7e0a7175a72772e1a963c519ab4714
|
|
| BLAKE2b-256 |
82bca1b35770ed001c44b73a8d851b05a7d6b98007a7fd9393e94090630a1565
|
File details
Details for the file django_s3_aws-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_s3_aws-1.0.0-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 |
5ecc7534b1812d40e5884fe2eccf729635d17a1ba843d097206a9a4339f8984b
|
|
| MD5 |
0deed6706af5360fe25f37824a181e42
|
|
| BLAKE2b-256 |
b8013ffc38160731967def15e521c66839b6f069c973c08fcec4c8b18c8d212d
|