How I learned Django Media Serving Using Google Cloud Storage Signed URLS
About me
I am a self-taught developer, highly motivated and hardworking individual. I am passionate about building applications and writing scripts using Python programming language.
Why I wanted to learn Django Media Serving Using Google Cloud Storage Signed URLS
Django Web Framework does not serve static and media files using its server. There are third party applications that can do this, Whitenoise being one of them, but if you want to serve static and media files from another server for security purposes and speed, Whitenoise may not be of help. To do this you need to setup storage buckets or another server elsewhere. Given that in this specific project we were using Google Cloud Platform, Google Kubernetes Engine, I decided to use Google Cloud Storage to serve static and media files.
How I approached learning Django Media Serving Using Google Cloud Storage Signed URLS
I had no experience working with storage buckets before. First I went through Google Cloud Storage documentation which was very helpful to get to know how it worked. Despite this I did not find documentation/tutorial/blogposts about using Google Cloud Storage in this context ie with Django using signed urls. I had to consult with a developer who I had contact with and has been working with GCP for a long time with Elixir. That helped me but I still did not have something that could get me started.
Finally I came across a script on Google's github repositories on generating signed urls which I integrated in my application in django rest framework serializers. That configured together with django storages, uploading and accessing media and static files in my application using Google Cloud Storage became successful.
Challenges I faced
The major challenge I faced is lack of documentation in this context and this feature not supported by django storages. Also I did not have access to experienced developers who have done this before, so that I could consult from them.
Key takeaways
Patience pays. I had a problem with this but with diligence and research, I became successful in implementing the feature.
Tips and advice
Research, Research, Research! First understand how the tools you are using work.
From there you can build anything on top of them.
Final thoughts and next steps
It was a great learning process and one thing I would like to do later maybe is implement this feature on django storages both for Google Cloud Storage and AWS buckets.