Python

REST APIs in Django

I've been working on some RESTful APIs in Django. I know, Django's not the most efficient for this purpose, Flask et al may be better, but I've got a lot of template driven views, and loads of tables in the ORM.

In order to do this, I have been using the excellent Django REST framework which has allowed me to generate the API in record (pun intended) time. While its principle utility is in providing POST/GET/PUT/DELETE access to the ORM, it also has good support for transaction (non-table) access (i.e. returning the result of some complex calculation or multi-table transaction). It handles authentication and permissions with ease, so I was a happy bunny.

But, on top of all this awesomeness, I also used Django swagger in combination to give a browser friendly access to the API, invaluable during testing. You can always switch it OFF for production purposes.

With these 2 tools, what could have been a huge slog took but a day or so and has made subsequent development and testing far easier.

Version 1 published 15 Jul 2015, 5:23 p.m.