【问题标题】:UnknownTimeZoneError with django celeryDjango celery 的 UnknownTimeZoneError
【发布时间】:2013-07-21 23:17:41
【问题描述】:

我正在使用以下模块在 PyDev (eclipse) 中开发 Django 项目:

Django==1.5.1
MySQL-python==1.2.4b4
celery==3.0.21
django-celery==3.0.17
pytz==2013b

我安装了 celery 来自动化作业,并将下面的代码添加到我的 settings.py 底部。

import djcelery
djcelery.setup_loader()

我还将djcelery 应用程序添加到我的INSTALLED_APPS。当我使用以下方式运行服务器时:

python manage.py runserver

访问我的 localhost:8000 时出现以下异常。如果我从settings.py 中删除djcelery 代码,则服务器运行没有问题。关于我做错了什么有什么想法吗?

UnknownTimeZoneError at /
'America/Boston'
Request Method: GET
Request URL:    http://localhost:8000/
Django Version: 1.5.1
Exception Type: UnknownTimeZoneError
Exception Value:    
'America/Boston'
Exception Location: C:\Python27\lib\site-packages\pytz\__init__.py in timezone, line 185
Python Executable:  C:\Python27\python.exe
Python Version: 2.7.5
Python Path:    
['C:\\Python27\\lib\\site-packages\\oauth2-1.5.211-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\httplib2-0.8-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\pip-1.3.1-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\networkx-1.7-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\numpy-1.7.1-py2.7-win32.egg',
 'C:\\Python27\\lib\\site-packages\\twitter-1.9.4-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\twython-3.0.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\requests_oauthlib-0.3.2-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\requests-1.2.3-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\oauthlib-0.5.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\simplejson-3.3.0-py2.7.egg',
 'C:\\Python27\\lib\\site-packages\\tweepy-2.1-py2.7.egg',
 'C:\\Windows\\system32\\python27.zip',
 'C:\\Python27\\DLLs',
 'C:\\Python27\\lib',
 'C:\\Python27\\lib\\plat-win',
 'C:\\Python27\\lib\\lib-tk',
 'C:\\Python27',
 'C:\\Python27\\lib\\site-packages']
Server time:    Mon, 22 Jul 2013 22:50:03 -0400

【问题讨论】:

    标签: django eclipse django-celery pytz


    【解决方案1】:

    尝试在 settings.py 文件中将 TIME_ZONE var 设置为 None:

    TIME_ZONE = None
    

    【讨论】:

      猜你喜欢
      • 2013-03-19
      • 2019-11-15
      • 1970-01-01
      • 2015-08-27
      • 2011-06-19
      • 2021-12-25
      • 2012-10-26
      • 2012-10-06
      • 1970-01-01
      相关资源
      最近更新 更多