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:
目前,我正在使用1.6.1版本的官方Django教程和OSX上python的2.7.5版本。我在第2部分工作,这是管理界面。当我尝试进行/管理/投票/投票时,我得到以下错误报告:
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?
我尝试通过安装pip(需要安装setuptools)来安装pytz,但这并没有什么区别。另外,我将第二次学习这个教程,我知道一个月前我没有遇到这个问题。升级到小牛会造成一些问题吗?
4 个解决方案
#1
16
I was also getting the same error. I installed pytz
我也犯了同样的错误。我安装了pytz
$ pip install pytz
and then i restarted the server. The exception is no more now.
然后我重启服务器。现在这个例外已不复存在。
#2
13
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.
在继续搜索django和pytz之后,我发现了1.6 django版本的注释,其中提到,如果USE_TZ=True在您的settings.py中,您现在必须安装pytz来处理Sqlite3。
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.
我不知道USE_TZ对您的应用程序有什么影响,但是将这个值设置为False可以让我在本教程中继续学习。我希望Django教程能够被更新以反映这种变化。
#3
3
The solution is very simple..
解决方法很简单。
pip install pytz
and then stop and restart your server
然后停止并重新启动服务器。
#4
2
I had same error, then I installed pytz with pip install pytz
and again had same error until I restarted WSGI instance. (eg. touching wsig.py (touch wsgi.py
) or restarting apache (apache2ctl restart
)
我有相同的错误,然后我安装pytz与pip安装pytz,并再次有相同的错误,直到我重新启动WSGI实例。(如。触摸wsig。py(触摸wsgi.py)或重新启动apache (apache2ctl重启)
#1
16
I was also getting the same error. I installed pytz
我也犯了同样的错误。我安装了pytz
$ pip install pytz
and then i restarted the server. The exception is no more now.
然后我重启服务器。现在这个例外已不复存在。
#2
13
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.
在继续搜索django和pytz之后,我发现了1.6 django版本的注释,其中提到,如果USE_TZ=True在您的settings.py中,您现在必须安装pytz来处理Sqlite3。
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.
我不知道USE_TZ对您的应用程序有什么影响,但是将这个值设置为False可以让我在本教程中继续学习。我希望Django教程能够被更新以反映这种变化。
#3
3
The solution is very simple..
解决方法很简单。
pip install pytz
and then stop and restart your server
然后停止并重新启动服务器。
#4
2
I had same error, then I installed pytz with pip install pytz
and again had same error until I restarted WSGI instance. (eg. touching wsig.py (touch wsgi.py
) or restarting apache (apache2ctl restart
)
我有相同的错误,然后我安装pytz与pip安装pytz,并再次有相同的错误,直到我重新启动WSGI实例。(如。触摸wsig。py(触摸wsgi.py)或重新启动apache (apache2ctl重启)