can't import timezone

Asked by Edward

I have a very weird problem of import timezone issue after successfully installation with devstack. When you open the login page, you will see "Internal Server Error -500" and error logs captured below. I verified the related module of pytz has been already installed. But don't know why this happens. I have this problems in two machines which are ubuntu 11.10. I didn't see the problem in ubuntu12.04. Curiously!

=========================horizon log================================
[Thu Nov 22 11:17:03 2012] [error] Warning: Could not import Horizon dependencies. This is normal during installation.
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] mod_wsgi (pid=3801): Exception occurred processing WSGI script '/opt/stack/horizon/openstack_dashboard/wsgi/django.wsgi'.
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] Traceback (most recent call last):
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] File "/usr/lib/pymodules/python2.7/django/core/handlers/wsgi.py", line 250, in __call__
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] self.load_middleware()
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] File "/usr/lib/pymodules/python2.7/django/core/handlers/base.py", line 47, in load_middleware
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Thu Nov 22 11:17:03 2012] [error] [client 9.187.160.169] ImproperlyConfigured: Error importing middleware horizon.middleware: "cannot import name timezone"
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] mod_wsgi (pid=3800): Exception occurred processing WSGI script '/opt/stack/horizon/openstack_dashboard/wsgi/django.wsgi'.
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] Traceback (most recent call last):
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] File "/usr/lib/pymodules/python2.7/django/core/handlers/wsgi.py", line 250, in __call__
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] self.load_middleware()
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] File "/usr/lib/pymodules/python2.7/django/core/handlers/base.py", line 47, in load_middleware
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] raise exceptions.ImproperlyConfigured('Error importing middleware %s: "%s"' % (mw_module, e))
[Thu Nov 22 03:17:03 2012] [error] [client 9.187.160.169] ImproperlyConfigured: Error importing middleware horizon.middleware: "cannot import name timezone"
======================================================

Question information

Language:
English Edit question
Status:
Solved
For:
OpenStack Dashboard (Horizon) Edit question
Assignee:
No assignee Edit question
Solved by:
Edward
Solved:
Last query:
Last reply:
Revision history for this message
jiji (zzww-666) said :
#1

I have had the same problem ..

Revision history for this message
Rajesh kannan (rajeshkannan007) said :
#2

Hi Edward,

In order to change the timezone you can use either dashboard or inside /etc/openstack-dashboard/local_settings.py you can change the parameter below.

TIME_ZONE = "UTC"

and after chaning that you have to restart the apache2 and memcached..

$ sudo service apache2 restart
$ sudo service memcached restart

 now reload the dashboard and try to login..

Let me know if its helpful or not..

Regards,
Rajesh kannan

Revision history for this message
Edward (zhang-hare) said :
#3

thanks for you infor. I have checked the ./openstack_dashboard/local/local_settings.py, it is same as your setting.

Revision history for this message
Edward (zhang-hare) said :
#4

This problem is due to the old version of django, e.g version 1.3 on Ubuntu 11.04. This can be resolved by upgrade django to 1.4+. use following command to upgrade and verify.
sudo apt-get remove --purge python-django
sudo pip install --upgrade django
django-admin --version

Here's a link of how to-do.
http://stackoverflow.com/questions/10564757/turnkey-django-how-to-upgrade-django-to-1-4