Question

How to reduce the loading time of media folder?

I am developing an e-commerce website in Python Django, which has a media folder that is taking a lot of time to load when opening pages. I have hosted this project on DigitalOcean using a droplet. I need a solution so that my media folder does not take time to load. Can I keep the media folder on another server to reduce loading time? If so, how can I do this?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
May 28, 2024

Heya @zappcodeacademy,

I’ll recommend using a CDN first and then an object storage like DigitalOcean Spaces.

Spaces : Simple and scalable S3-compatible object storage with a built-in content delivery network (CDN) to store, serve, back up, and archive any amount of web content, images, media, and static files for your web apps.

You can read more about it here:

https://www.digitalocean.com/products/spaces

and here:

https://www.digitalocean.com/pricing/spaces-object-storage

Good thing is that it’s a DigitalOcean product which works really good with other products like your Droplet.

Bobby Iliev
Site Moderator
Site Moderator badge
May 27, 2024

Hi there,

One option here is to use an S3 storage, like the DigitalOcean Spaces together with CDN enabled:

https://docs.digitalocean.com/products/spaces/how-to/enable-cdn/

You can follow the steps on how to integrate Django with the DigitalOcean Spaces here:

https://www.digitalocean.com/community/tutorials/how-to-set-up-object-storage-with-django

Alternatively, if you don’t want ot use an S3 storage, you could try just using a standard CDN like Cloudflare instead:

https://cloudflare.com/

Let me know how it goes!

- Bobby

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more