Problems upgrading to Django 1.2.4 by downloading the package manually and running the install?
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/servers/basehttp.py",
line 280, in run
self.result = application(self.environ, self.start_response)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/servers/basehttp.py",
line 674, in __call__
return self.application(environ, start_response)
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/handlers/wsgi.py",
line 230, in __call__
self.load_middleware()
File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/django/core/handlers/base.py",
line 42, in load_middleware
raise exceptions.ImproperlyConfigured('Error importing middleware
%s: "%s"' % (mw_module, e))
ImproperlyConfigured: Error importing middleware events.middleware:
"cannot import name get_current_site"
I searched the django source for 1.2.3 and there's no references to
"get_current_site", so it's something new in 1.2.4. Here's the
description of what it does from the Django site
(http://docs.djangoproject.com/en/1.2/ref/contrib/sites/):
Changed in Django Development version. For code which relies on getting the current domain but cannot be certain that the sites framework will be installed for any given project, there is a utility function get_current_site() that takes a request object as an argument and returns either a Site instance (if the sites framework is installed) or a RequestSite instance (if it is not). This allows loose coupling with the sites framework and provides a usable fallback for cases where it is not installed.To fix the problem, stop any runserver you have going and reinstall django from pip: sudo pip install http://www.djangoproject.com/download/1.2.4/tarball/ Restart your project and it'll work fine. Installing from pip must do something that we neglected to do installing manually. Share on Twitter Share on Facebook