Cloudflare R2¶
Cloudflare R2 implements an S3 Compatible API. To use it as a django-storages backend:
Create an R2 bucket using Cloudflare’s web panel or API
Follow Cloudflare’s docs to create authentication tokens, locking down permissions as required
On your Cloudflare dashboard, create a Custom Domain that has your Static URL. This should match your Static_URL in your Settings.py file (e.g. static.domain_name.com)
Follow the instructions in the Amazon S3 docs with the following exceptions:
Set
bucket_nameto your previously created bucketSet
endpoint_urltohttps://<ACCOUNT_ID>.r2.cloudflarestorage.comSet the values of
access_keyandsecret_keyto their respective Cloudflare keys
Note
If you need a jurisdiction-specific endpoint or other advanced features, consult the Cloudflare docs.