Invalid Django TIME_ZONE

Posted 大大的大笨熊

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Invalid Django TIME_ZONE相关的知识,希望对你有一定的参考价值。

在linux操作系统运行,设置的时区在系统文件/usr/share/zoneinfo/中找不到会出现以下错误

  1. raceback (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 

    比如Asia/shanghai也会出错,真正文件夹/usr/share/zoneinfo/Asia/Shanghai,因此需要设置为Asia/Shanghai

 

以上是关于Invalid Django TIME_ZONE的主要内容,如果未能解决你的问题,请参考以下文章

django 默认时区设置

如何在视图中正确设置django time_zone以正确使用日期时间

Django 时间与时区设置问题

Django 时间与时区设置问题

Django时区

Django时区