Report this

What is the reason for this report?

How to reduce the loading time of media folder?

Posted on May 27, 2024

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?



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!

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.

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

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.

The developer cloud

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

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.