[Tutor] Django REST API Question

Sreenathan Nair sreenath.cg at gmail.com
Tue Mar 14 16:48:45 EDT 2017


I am trying to setup a django REST based service, following is my setup:

MySQL DB Table (Inventory) contents is retrieved by a Django REST API query
and finally passed as a list of dictionaries to a python code which will
then implement some business logic based on this list. The working
requirement right now is that there is no plan for users interacting with
the app using a web interface (planning to use a QT desktop app for this).

What I have so far, I've setup the models and model serializers, in my view
I've defined a ListApiView with a get_quey_set method that will return a
Response object with my list using json.dumps. The python code that does
the query is using request.get on a url in order to get this json formatted
list to work on.

My question is if this is a valid approach to what I am trying to achieve?
Am I missing something in the setup and/or would anyone recommend an
alternative approach to doing this?

I'm using Python 2.7 with the latest build of Django and the Django REST
framework, presently everything is running on a testing machine using
CentOS 7.

Any feedback is greatly appreciated, thank you for your time.

More information about the Tutor mailing list