Skip to content

Instantly share code, notes, and snippets.

@jerinisready
Created May 6, 2018 15:20
Show Gist options
  • Save jerinisready/0b3cdd09dbc972711a4f3fabcd5cd42b to your computer and use it in GitHub Desktop.
Save jerinisready/0b3cdd09dbc972711a4f3fabcd5cd42b to your computer and use it in GitHub Desktop.
I got " NotImplementedError: This backend doesn't support absolute paths. " when integrated a project's Media storage with `S3 Bucket` with `django-storage` and `boto3`. This was because of the conflict, that was in the s3boto storage class the path method was not implemented. Here is how I solved It. I created a new Class Inderrited From Boto3S…
from django.utils.encoding import filepath_to_uri
from storages.backends.s3boto3 import S3Boto3Storage
class CustomStorage(S3Boto3Storage):
def path(self, name):
return filepath_to_uri(name)
"""
# in settings.py, I Updated
DEFAULT_FILE_STORAGE = '<project_name>.s3boto3_overrided_storage.CustomStorage'
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment