Skip to main content

Custom Django storage backend for AWS S3 using boto3

Project description

🌐 django-s3-aws

Python
Django
License

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


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_s3_aws-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

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

Hashes for django_s3_aws-1.0.0.tar.gz
Algorithm Hash digest
SHA256 96c40f522819ad89bb0859bd3feee88541017cb8b832cbe97001700a35f7f79c
MD5 aa7e0a7175a72772e1a963c519ab4714
BLAKE2b-256 82bca1b35770ed001c44b73a8d851b05a7d6b98007a7fd9393e94090630a1565

See more details on using hashes here.

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

Hashes for django_s3_aws-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ecc7534b1812d40e5884fe2eccf729635d17a1ba843d097206a9a4339f8984b
MD5 0deed6706af5360fe25f37824a181e42
BLAKE2b-256 b8013ffc38160731967def15e521c66839b6f069c973c08fcec4c8b18c8d212d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page