the question is why, why would you want to store a global connection for a
REST server?
keep in mind that you would be making HTTP requests, meaning even that you
had a global variable holding the connection it would just open and close
each tie you make a request.

if you need t keep a connection open than maybe you don't need a REST
server but something else.

On Wed, Nov 4, 2015 at 7:02 PM, Gergely Polonkai <gerg...@polonkai.eu>
wrote:

>
> On 4 Nov 2015 17:31, "kk" <krm...@gmail.com> wrote:
> >
> >
> > Ok one question,
> > I would like to store a client connection in some kind of a global place
> for my entire Django frontend.
> > So that the request object can be used from any view.
> > Can you sug    gest some guideline to do this?
> > Happy hacking.
> > Krishnakant.
>
> That *may* work in your development server, but not in production. Most
> production environments run instances on a per-request basis, so the global
> connection you open for connection A will most probably be closed when the
> connection B arrives.
>
> >
> >
> > On Tuesday 03 November 2015 08:35 PM, Remco Gerlich wrote:
> >>
> >> Django code is just normal Python. Python can call REST APIs, sure (a
> nice library is Requests: docs.python-requests.org/en/latest/ )
> >>
> >> Doing this in the view means that the user has to wait until the
> request ends before he gets a response. Possibly this will make the view
> too slow. You could also do the API requests in the background using
> Celery, and show the results some other way.
> >>
> >> Remco Gerlich
> >>
> >>
> >> On Tue, Nov 3, 2015 at 12:44 PM, kk <krm...@gmail.com> wrote:
> >>>
> >>> Dear all,
> >>> I wish to know if I need to do some thing special for consuming a
> RESTfull server from some other provider?
> >>> What should I do in the views?
> >>> Do I need the complete DRF to do this?
> >>> Can I do this with just Django's views and then send data across to
> templates?
> >>> I mean, can I write views to connect and call the API, send and
> receive data and then send the output to the templates?
> >>> The encoding is in json when interacting with the remote REST API.
> >>> happy hacking.
> >>> Krishnakant.
> >>>
> >>> --
> >>> 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+unsubscr...@googlegroups.com.
> >>> To post to this group, send email to django-users@googlegroups.com.
> >>> Visit this group at http://groups.google.com/group/django-users.
> >>> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/56389E08.10105%40gmail.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+unsubscr...@googlegroups.com.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/django-users.
> >> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAFAGLK1rzNjgB2XxckRkZJqgOppwS6CiMxxwMd%2BmChnvKuy1Lw%40mail.gmail.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+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/563A32E4.1050105%40gmail.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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CACczBUK%2BdYHCQbBgR%3DHWfKqihL3LPPRFTAQRFz8%3Djgk6UTQkcg%40mail.gmail.com
> <https://groups.google.com/d/msgid/django-users/CACczBUK%2BdYHCQbBgR%3DHWfKqihL3LPPRFTAQRFz8%3Djgk6UTQkcg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
> 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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAFWa6tKUyxaOwb9gtPVPK1mz8EAjhARrVf%3D5GsiZT%3Ddu3Lc1vw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to