I'm trying to send a list of datetimes to the client by JSON formatted as its locale.
So the main issue is actually trying to get the locale of the client.
I tried to use request.META['LC_TIME']
(which seems to be the client's prefered locale for dates and times)
This key is here in development but not in production.
KeyError: 'LC_TIME'
How can it be explained ? Am I on the right track ?
First, let's determine what you mean under 'Production environment'. Under DEV environment, the browser connects directly to the Django web server, and all HTTP headers are sent directly to it. In PRODUCTION, you usually have a proxy. This could be an nginx or other similar software. Their main purpose is to redirect, while performing some checks. You should check in your PRODUCTION environment, what is the actual setup of the proxy(if any), and if it strips any HTTP header sent from client(which seems like a valid reason for the error you get).
Besides the configuration issues, it is recommended to use a default value: