File Uploads with Django & DRF

submited by
Style Pass
2024-06-11 21:30:05

From time to time I work on Django projects that offload two problems that Django solves reasonably well to third-party SaaS services: auth and files. Usually there is no need to purchase a SaaS subscription unless you have specific requirements that Django doesn't have an answer for, such as SSO & directory sync or the need for gigantic files.

I like to keep the stack as simple as possible in my projects. Simple and contained stacks are easier to hack and contribute to, integration test and run locally. As an added bonus it keeps costs down.

In this article I'll explain how I solve the latter problem - file uploads. I've built file upload APIs with Django on more than one occassion and I'll try to synthesize what I've learned. The post below shows a few variants of how to build a file API using the Django REST Framework. It also details how to connect Django to a cloud storage backend for production-grade systems where you're deploying many Django servers.

I've created a sample repository with the examples at:

Leave a Comment