Andy Gardner
2018-11-22 15:40:55 UTC
I am new to Django, Python and Rest API's and have been learning it over
the last few weeks with a view to generating REST API's to control an
engine process.
Currently I have an engine process running in the background, and a python
based test harness, which takes JSON encoded requests containing the
command and the data parameters. I currently use a simple command line to
write the JSON encoded requests and I get back JSON encoded replies, eg. I
send a login request to the backend process and I get a session id back
from it, which then has to be passed in subsequent engine requests.
I have worked my way through William S Vincent's books for a beginner's
guide to Django and the follow-up Rest API's and I can see how quick and
useful the Django framework is for mocking up web pages and all the work
behind it to display, but it seems that all the examples are database based
and displaying of the contents all self-contained, which is not what I want
to do.
I want to be able to create an API that sends requests to my test harness
(eventually this will be replaced with a proper middleware process but
doing the same sort of thing) and handles the replies. I was thinking along
the lines of creating an app per CLI call (ie. command request to test
harness), so I do not see any need for an underlying database or storage of
data as the API will eventually be used by an existing GUI that I will be
supplying the API's to. Neither can I really use the Django login framework
and authentication as I need to interact with the login mechanism with the
backend process ie the backend process needs to hold information on any
requests to create users and when those users login supply session id - the
backend process needs to work for many users in parallel).
So my question is, is Django the right framework for what I want to do, or
should I be looking at a different framework, can I write Rest API's that
send JSON encoded command and parameter data requests and get back JSON
encoded responses from my engine process? If the answer to the last
question is yes, can someone give me an example on how I write that using
Django ie. do I not bother with a model, but just serialize a set of fields
to represent the command and the data parameters for that request the app
represents? Instead of using framework .as_view() functions etc do I write
my own messaging function or does the framework actually have something
already to do this kind of thing?
Thanks in advance for answers/suggestions etc?
Andy
--
CONFIDENTIALITY NOTICE: This e-mail transmission and/or any
attachments may contain confidential information belonging to the sender.
Any unauthorised interception of this transmission is illegal under the
law. If you have received this transmission in error, please promptly
notify the sender by reply e-mail, and then destroy all copies of the
transmission.
the last few weeks with a view to generating REST API's to control an
engine process.
Currently I have an engine process running in the background, and a python
based test harness, which takes JSON encoded requests containing the
command and the data parameters. I currently use a simple command line to
write the JSON encoded requests and I get back JSON encoded replies, eg. I
send a login request to the backend process and I get a session id back
from it, which then has to be passed in subsequent engine requests.
I have worked my way through William S Vincent's books for a beginner's
guide to Django and the follow-up Rest API's and I can see how quick and
useful the Django framework is for mocking up web pages and all the work
behind it to display, but it seems that all the examples are database based
and displaying of the contents all self-contained, which is not what I want
to do.
I want to be able to create an API that sends requests to my test harness
(eventually this will be replaced with a proper middleware process but
doing the same sort of thing) and handles the replies. I was thinking along
the lines of creating an app per CLI call (ie. command request to test
harness), so I do not see any need for an underlying database or storage of
data as the API will eventually be used by an existing GUI that I will be
supplying the API's to. Neither can I really use the Django login framework
and authentication as I need to interact with the login mechanism with the
backend process ie the backend process needs to hold information on any
requests to create users and when those users login supply session id - the
backend process needs to work for many users in parallel).
So my question is, is Django the right framework for what I want to do, or
should I be looking at a different framework, can I write Rest API's that
send JSON encoded command and parameter data requests and get back JSON
encoded responses from my engine process? If the answer to the last
question is yes, can someone give me an example on how I write that using
Django ie. do I not bother with a model, but just serialize a set of fields
to represent the command and the data parameters for that request the app
represents? Instead of using framework .as_view() functions etc do I write
my own messaging function or does the framework actually have something
already to do this kind of thing?
Thanks in advance for answers/suggestions etc?
Andy
--
CONFIDENTIALITY NOTICE: This e-mail transmission and/or any
attachments may contain confidential information belonging to the sender.
Any unauthorised interception of this transmission is illegal under the
law. If you have received this transmission in error, please promptly
notify the sender by reply e-mail, and then destroy all copies of the
transmission.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/14cea50a-dd1c-4746-9547-7a71a2e146e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+***@googlegroups.com.
To post to this group, send email to django-***@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/14cea50a-dd1c-4746-9547-7a71a2e146e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.