Saturday, October 8, 2022

Re: META data differs between development runserver and Apache

Hello Everyone,

I have been digging into this problem and I have discovered the following. (Which is new to me as a newbie but maybe common knowledge to experienced users)
Regarding the  (request.META)  the request is an instance of HttpRequest class. When I looked this up in Django I found this:
____________________________________
HttpRequest.META

A dictionary containing all available HTTP headers. Available headers depend on the client and server, but here are some examples:

_______________________________

It states the available headers depend on the client AND server. SO when I run the code on the development runserver in visual studio code, it provides the LOGNAME and TZ (Time zone) but apparently apache does NOT. 

The question is why, and how can I fix this? I think I might be able to work around the LOGNAME but the timezone TZ is more difficult to figure out. 


ANY clues are appreciated,


Moose

On Friday, October 7, 2022 at 10:24:16 PM UTC-4 Moose Smith wrote:
I am a Django Newbie,

My problem is simple, when I run my code on the built in development server using Visual Studio Code on the server machine, my code works. When I run the same code on the same server using Apache the code fails. 

Specifically:
var1=(request.META)
var2=var1['LOGNAME']
or 
var2=var1['TZ']

IN both instances the name LOGNAME and TZ do not exist when the code is run on the apache server. (I get a Keyerror - does not exist) What must be happening is the data in var1 differs between the development server and apache.  

My question is why? I suspect it has something to do with WSGI?

Any clue will be greatly appriciated.

Moose
  

--
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+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/69131c4e-b29d-4c5c-85b9-9090bfd9bb5dn%40googlegroups.com.

No comments:

Post a Comment