Magesh Ravi

Magesh Ravi

Artist | Techie | Entrepreneur

The curious case of quoted TIME_ZONE value

Last night, during one of our Django deployments, I encountered the following error while starting the uWSGI service.

ValueError: Incorrect timezone setting: "America/Los_Angeles"

I verified the timezone string is valid and the OS/python/pytz versions supported this timezone.

After much investigation, trial and error, I finally found the issue in the uwsgi_env.ini file,

env = DJANGO_TIME_ZONE="America/Los_Angeles"

Removing the quotes fixed the issue.

env = DJANGO_TIME_ZONE=America/Los_Angeles

However, the quotes on other environment variables had no such effect,

env = DJANGO_STATIC_ROOT="/var/www/staging.xzysite.com"
env = DJANGO_STATIC_URL="/static/"

I'm curious why the quotes cause trouble only for the TIME_ZONE setting.

Last updated: Nov. 8, 2024, 5:30 a.m.