Cerin
Cerin

Reputation: 64739

Invalid Django TIME_ZONE

Doing a recent build, I ran Django's syncdb, and I'm getting the error:

Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/core/management/__init__.py", line 252, in fetch_command
    app_name = get_commands()[subcommand]
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/core/management/__init__.py", line 101, in get_commands
    apps = settings.INSTALLED_APPS
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/utils/functional.py", line 276, in __getattr__
    self._setup()
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/conf/__init__.py", line 42, in _setup
    self._wrapped = Settings(settings_module)
  File "/usr/lib/python2.6/site-packages/Django-1.3-py2.6.egg/django/conf/__init__.py", line 125, in __init__
    raise ValueError("Incorrect timezone setting: %s" % self.TIME_ZONE)
ValueError: Incorrect timezone setting: America/New_York EST5EDT SystemV/EST5EDT US/Eastern

I haven't changed any of my core settings, so I don't know why I would suddenly be getting this error. The value in my settings.py file is TIME_ZONE = 'America/New_York', which is a valid value according to List of tz database time zones. Why isn't Django accepting this value?

Upvotes: 11

Views: 20684

Answers (2)

I got the error below. *I use Django 4.2.1:

zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key America/NewYork'

Because I set 'America/NewYork' to TIME_ZONE as shown below:

# "settings.py"

TIME_ZONE = 'America/NewYork'

So, I set 'America/New_York' to TIME_ZONE as shown below, then the error was solved:

# "settings.py"
                      # ↓ "_" is added
TIME_ZONE = 'America/New_York'

Upvotes: 1

manji
manji

Reputation: 47978

According to the error message:

ValueError: Incorrect timezone setting: America/New_York EST5EDT SystemV/EST5EDT US/Eastern

it seems that TIME_ZONE, in settings.py, is equal to : America/New_York EST5EDT SystemV/EST5EDT US/Eastern

You must write only America/New_York.

If it's not the case, check for the existence of the file:

/usr/share/zoneinfo/America/New_York

if it's absent, that time zone is invalid on your system.

(valid time zones are in /usr/share/zoneinfo/)

Upvotes: 34

Related Questions