This project aims to provide a custom storage backend for Supabase Storage so that it can be used as /media
storage. This project heavily references the S3/Google Custom Storage backend in Django-Storages
To do this we follow the specification provided by Django
Eventually, we hope that this can be integrated into the django-storages library and then write a blogpost/tutorial about it.
-
pip3 install django-storage-supabase
-
In
settings.py
set the following variables
DEFAULT_FILE_STORAGE = 'django_storage_supabase.supabase'
SUPABASE_API_KEY = ''
SUPABASE_URL = "https:<your-supabase-id>"
SUPABASE_ROOT_PATH = '/dir/'
You can then use the following to upload to your backend.
photo = models.FileField(
upload_to='photos',
)
Here's a reference (WIP) example of how to use Supabase storage as a backend together with the rest of the Supabase libraries.
- Implement save
- Implement open and write
- Test the package.