Discussion:
Is Django and DjangoRestAPI's the correct framework for my project?
Andy Gardner
2018-11-22 15:40:55 UTC
Permalink
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.
--
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.
TimT Vogt
2018-11-22 17:05:43 UTC
Permalink
What problem are you trying to solve?
What reason do You use djanfo now for?

And what do You want with the json?
Stored? Displayed? Or put trough as other apps might use the data?
Tim


Verstuurd vanaf mijn iPhone
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.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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/DAFB1075-24FA-4F83-8DAE-BEA9CAAB70FE%40gmail.com.
For more options, visit https://groups.google.com/d/optout.
Andy Gardner
2018-11-22 17:18:54 UTC
Permalink
Essentially I want to end up with a set of API's that will send a JSON
encoded request along with data parameters to a middleware process and pass
out the returning JSON encoded replies, either as a single string or a set
of extracted data parameters. I have about 50+ CLI calls to represent in
this way, so I was thinking of representing each call eg. create_user,
login, logout, delete_user, run_emulation, change this emulation parameter
etc, with an app or single api call. It doesn't have to be using the Django
framework - if there is a more appropriate one that will allow me to
produce a set of Restful API's to complete this, then I am open to
suggestions on that front as well - it just so happens I started with
Django and why I'm querying whether it's the right way to go, and if so,
how do I implement it (presumably I don't need to create a model, but I
probably need to set up a view and a serializer?)

Andy
Post by TimT Vogt
What problem are you trying to solve?
What reason do You use djanfo now for?
And what do You want with the json?
Stored? Displayed? Or put trough as other apps might use the data?
Tim
Verstuurd vanaf mijn iPhone
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.
--
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
<javascript:>.
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
<https://groups.google.com/d/msgid/django-users/14cea50a-dd1c-4746-9547-7a71a2e146e0%40googlegroups.com?utm_medium=email&utm_source=footer>
.
For more options, visit https://groups.google.com/d/optout.
--
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/00486a69-f8b1-4f85-a5d4-7ee676c53721%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Ryan Nowakowski
2018-11-22 21:35:59 UTC
Permalink
Django can definitely do what you want. It just sounds like you won't
be using very many of it's built-in features.

- Ryan
Post by Andy Gardner
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.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
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/20181122213559.GE8710%40fattuba.com.
For more options, visit https://groups.google.com/d/optout.
Loading...