Create a Storage Space (optional)
Django is a fantastic in almost all respects. But it isn't optimized for serving media content. If you plan on serving large media files through your application, consider creating a storage space.
Last updated
Django is a fantastic in almost all respects. But it isn't optimized for serving media content. If you plan on serving large media files through your application, consider creating a storage space.
Last updated
Django is not great at serving static content, it's true. And while we include pre-configured NGINX configurations with our products, you may still want to consider getting a dedicated storage space. Some of our products even come pre-configured for using a DigitalOcean managed storage space, so all you'll need to do is enter in your credentials.
Note that you may also reference the Digital Ocean guide for these steps.
To get started, access your DigitalOcean dashboard, and find the 'Create > Spaces' option. You'll be presented with a couple of options, which we will work through step-by-step below.
As with the droplet and managed database, you'll need to select a region to locate your space. We recommend you locate this in the same region as your droplet if possible. Or at least in as close proximity as possible.
Next, you'll have the option of enabling a Content Delivery Network (CDN). This service provides some performance improvement by caching your files at the edge. It's optional, but can offer a good performance boost when serving content to users across the globe.
Finally, you need to select whether you would like to allow anonymous users (those not accessing the space through your application for example) with permissions to list your space content. Make the choice, but do note that selecting 'restricted' won't make your files private. For that, you'll need to ensure you change the file property manually through DigitalOcean's space browser, or ensure that you are uploading the file using our custom private media storage class.