11

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?

Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129
Cerin
  • 60,957
  • 96
  • 316
  • 522

2 Answers2

32

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/)

manji
  • 47,442
  • 5
  • 96
  • 103
  • You're quite right. A bug in my deployment script caused on old cached version of my settings.py to be used, which had this invalid TIME_ZONE value. – Cerin Apr 22 '11 at 15:04
  • 1
    Please also note that the failing setting can be as subtle as `TIME_ZONE = 'America/New York'` instead of `TIME_ZONE = 'America/New_York'` That's what happened to me, and I had a two-year old version of Django. – octopusgrabbus Aug 06 '12 at 15:09
0

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'
Super Kai - Kazuya Ito
  • 22,221
  • 10
  • 124
  • 129