On Apr 7, 12:54 pm, Graham Dumpleton <[email protected]>
wrote:
> On Apr 7, 2:33 pm, Coonay <[email protected]> wrote:
>
> > i want to get a WebOb Request ASAP when the WSGIHandler is called,such
> > as retrieve the SERVER_NAME and SERVER_PORT meta information from the
> > request,my stupid idea is in the line 261 of wsgi.py that add
> > following :
>
> >         server_name =  request.META['SERVER_NAME']
> >         if ( server_name is not None and server_name.startswith
> > ('localhost') ):
> >             settings.DEBUG = True
>
> > Could you tell me how to get a  WebOb Request at first place
> > correctlly?

Hi, Graham :


"Django creates an HttpRequest object that contains metadata about the
request. Then Django loads the appropriate view, passing the
HttpRequest as the first argument to the view function"

My question is  how to get the  http request object at first
place,then i can retrieve the meta
information  such as SERVER_NAME and SERVER_PORT from the request.

>
> If your intention is that different clients, based on how they connect
> to the server, ie., FQDN vs localhost, will conditionally determine
> whether debug is enabled or not, then do note that this scheme will


WSGIHandler  is instantiated per every http request,so i think it's
thread-safed,
why do u think it will fail?

> fail miserably if a multithreaded hosting mechanism is used. Your code
> is also not addressing how one would reset the value after a request
> even if a single threaded hosting mechanism was used.
>
> How about explain better what it is you want to achieve from doing
> this. Certain hosting mechanisms could achieve a separation without
> such a hack, but the question is why you would want to do it in the
> first place.
>
> Graham
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to