Django TIME_ZONE无效

时间:2011-04-21 21:49:28

标签: python django

做了最近的构建,我运行了Django的syncdb,我收到了错误:

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

我没有更改任何核心设置,所以我不知道为什么我会突然收到此错误。我的settings.py文件中的值为TIME_ZONE = 'America/New_York',这是this的有效值。为什么Django不接受这个值?

1 个答案:

答案 0 :(得分:28)

根据错误消息:

  

ValueError:时区不正确   设置:America / New_York EST5EDT   SystemV / EST5EDT US / Eastern

似乎TIME_ZONE中的settings.py等于:America/New_York EST5EDT SystemV/EST5EDT US/Eastern

您必须只写America/New_York

如果不是这样,请检查文件是否存在:

  

<强>的/ usr / share / zoneinfo中/美/纽约

如果没有,则该时区在您的系统上无效。

(有效时区位于/usr/share/zoneinfo/