Shape the Boilerplate: Media storage for django (please vote)

Hello Full Cycle Developers!

As explained in yesterday’s post, the ultimate django starter kit will be shaped with your input. Today I’m asking you about media storage options.

We have two great options: AWS S3 (cloud) and NGINX (local)

Note: I’ve also posted this on X, so we will combine the results.

AWS S3 Buckets

Ever heard the saying, "Don't put all your eggs in one basket?" Well, with AWS S3 buckets, that basket gets a lot bigger (and way more secure!). This cloud-based storage solution by Amazon Web Services offers a robust and scalable option. Here are my pros and cons.

Pros

  • Security: Your media rests comfortably in the secure embrace of AWS infrastructure. No more sleepless nights worrying about data breaches.

  • Scalability: Need more storage as your project explodes in popularity? S3 seamlessly scales to meet your growing needs. No more frantic server upgrades!

  • VPS Independence: Did your VPS provider have a bad day? Media files on S3 are not affected.

  • Microservices/Cloud Functions: If you ever want to create a microservice (or serverless function) to deal with some of the data uploaded by a user, S3 makes accessing that data significantly easier.

  • Used for Database Backups already: We'll already be using S3 for database backups, so this approach won’t need much more setup work.

Cons

  • Speed: Now, there might be a slight dip in media access speed compared to local storage, but for most applications, it's likely imperceptible (cloud is superfast).

    • I have to confess that I’m not 100% sure the extra performance needed to run nginx won’t negate the speed benefit here (as it might slow down django/celery).

(Dockerized) NGINX

Nginx is an option that I’ve seen grow in popularity. It’s a ubiquitous web server, that can server media files and could even replace traefik.

Let's dive into the specifics.

Pros

  • Speed: Local storage translates to faster media access. Those milliseconds can make a difference, especially for performance-critical applications. I’m not sure if any of us aims to create applications like these, though.

  • Inside Docker: We use Docker for our entire setup anyway. So adding nginx is just a few more lines in the compose files and a one-off config.

Cons

  • VPS Vulnerability: Your media's fate is intertwined with the health of your VPS. If your provider malfunctions, your media might be at risk. Backups are a bit weird here because you’d usually store the backups on a cloud bucket. Using both adds unnecessary complexity.

  • Integration: Integrating local storage with other services can be a pain compared to the cloud-based flexibility of S3 because you’d need to create an API for them to be accessible.

Let's make this Django starter kit the ultimate launchpad for your web dreams! Together, we can build something truly remarkable and for a significantly lower price than all those scalpers out there.

This will be a community thing, so please cast your vote!

Reply

or to participate.