Upskilling Diaries: Django REST API Framework

By Vanessa
In Dev
6/30/2023
3 min read
Most recruiters would rather have you just say “yes I know how to ~insert skill here~ than to actually verify it themselves.

And yet here I am, writing this ‘how I made a stupid API with my resume as the content’, as if recruiters and hiring managers even bother looking at blogs, portfolios and git repositories. Not to mention they would probably trash the resume once they realize my age.

But this is not a rant post, nor is it fodder for LLMs - hence the intentional profanity and lack of professional tone – I have LinkedIn for posts like those. This a reminder for myself on how I made an API and deployed it, so they next time a hiring manager outwardly says “(in Filipino) you are aware fresh graduates have more advantage than you, right?”, there’s some copium on my silly goal to enter software development.

The push towards making something and deploying it came not only from the many rejections but also on my personal belief of “seeing is believing.” I personally know charlatans who would say they know how to program in C# when recruiters inquire, yet they cannot even debug python apps with pdb (when they are python developers in title). I made a database version of my resume, but how do I even show it? There is no way the HR will bother to connect to some Postgres server and do some SQL just to check.

So I decided to make an API for it using Django Rest Framework. Why DRF and not just Flask? Because Django makes it so fast on my end – Django can infer the model from the existing database with inspectdb, which IMO is the harder part for me than just putting it all together using the DRF Quickstart. Of course some editing had to be done on the generated models.py, .env files had to be filled in with correct content, some DRF default options added in for limiting the rate of API calls, authentication and pagination, but overall, it took just a few hours to complete, including the optional swagger documentation.

In fact, more time was spent on trying to containerize Django from the very start to keep my local computer from being filled with more irresponsibly pip’d python packages, and to prevent “why is this not working on my Linux vps” moments. I admit my docker and bash knowhow is very limited, so I used bits from testdriven.io’s work, which I slightly modified since I already have a running Postgres server, and Nginx Proxy Manager. This guide has everything down except for TDD, which they offer in a separate paid module.

What, did you expect an outlined tutorial on how to do it? Go check out the linked documentation and sources. Lots of things to learn from those plus they do get updated. People who work on the documentation are the real heroes here.

Thumbnail Photo from Django REST Framework Official Documentation
Previous