python pytz 安装_Django教程 - 未正确配置的异常(pytz未安装)

I'm currently working through the official Django tutorial using version 1.6.1 and version 2.7.5 of python on OSX. I'm working on part 2, which is the admin interface. When I attempt to go to /admin/polls/poll/, I get the following error report:

ImproperlyConfigured at /admin/polls/poll/

This query requires pytz, but it isn't installed.

Request Method: GET

Request URL: http://127.0.0.1:8000/admin/polls/poll/

Django Version: 1.6.1

Exception Type: ImproperlyConfigured

Exception Value:

This query requires pytz, but it isn't installed.

Exception Location: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py in datetime_trunc_sql, line 196

Python Executable: /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python

Python Version: 2.7.5

I attempted to install pytz by installing pip (which required installing setuptools) but this made no difference. Also, I am going through this tutorial for a second time, and I know I didn't run into this problem a month ago. Could updating to Mavericks have caused some problem?

解决方案

After continuing to search for django and pytz, I found the 1.6 Django release notes, which mention that you must now install pytz to work with Sqlite3 if USE_TZ=True in your settings.py.

I don't know what effect USE_TZ has on your application, but setting that value to False allows me to proceed in the tutorial. I would hope that the Django tutorial is updated to reflect this change.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值