Saturday, October 8, 2022

Re: META data differs between development runserver and Apache

It seems like runserver is picking up your shell environment variables and including them in request.META. Apache doesn't do that so you'll need to figure out a different way to get that info.

What are you using LOGNAME and TZ for? You can probably use Django's timezone support instead of TZ.

On October 7, 2022 9:24:16 PM CDT, Moose Smith <47kangaroo@gmail.com> 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
  

No comments:

Post a Comment