Report this

What is the reason for this report?

Setting a Storage Limit for Individual DigitalOcean Spaces (S3)

Posted on January 4, 2022

I plan on having multiple Django (Wagtail) apps on my DigitalOcean stack each handling hundreds of large images (media files in general). Normally, I use the default Django media storage settings which stores all of it on the disk of the DO Droplet inside the project directory, but I want to dip my toes into implementing S3 with DO Spaces.

DO Spaces offers 250GB shared between the amount of Spaces instances you create and also offers a CDN which seems quite easy to set up (at least on DO’s side).

I am concerned that my Django projects may eat up a lot of this storage allocation, therefore I want to be able to limit each of my Django apps to only use a maximum of 25GB. I will create a management command which will delete old media files and will be run by the DO Droplet as a cron job.

Is there a way to limit the maximum storage limit for one “space”?

Is there a way to set the maximum storage limit for each Django project with django-storages?

What is the best way to achieve this?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.