Django Tutorial - ImproperlyConfigured exception (pytz isn't installed)

John D. picture John D. · Jan 13, 2014 · Viewed 8.1k times · Source

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?

Answer

prashantsahni picture prashantsahni · Oct 20, 2014

I was also getting the same error. I installed pytz

$ pip install pytz

and then i restarted the server. The exception is no more now.