On Apr 7, 2:33 pm, Coonay <fla...@gmail.com> 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?
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
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 django-users@googlegroups.com
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---