django-tracking not compatible with Django 1.6

727 Views Asked by At

I am trying to convert a Django 1.3 app to Django 1.6. I am using the django-tracking package but when I start the runsever I get the following error:

Unhandled exception in thread started by <function wrapper at 0x10868e9b0>
Traceback (most recent call last):
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/utils/autoreload.py", line 93, in wrapper
    fn(*args, **kwargs)
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 101, in inner_run
    self.validate(display_num_errors=True)
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/base.py", line 310, in validate
    num_errors = get_validation_errors(s, app)
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/core/management/validation.py", line 34, in get_validation_errors
     for (app_name, error) in get_app_errors().items():
 File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 196, in get_app_errors
    self._populate()
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 78, in _populate
    self.load_app(app_name)
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/db/models/loading.py", line 99, in load_app
    models = import_module('%s.models' % app_name)
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
    __import__(name)
  File "/Users/athom09/Projects/openemory1.6/openemoryEnv/lib/python2.7/site-packages/tracking/models.py", line 5, in <module>
    from django.contrib.gis.utils import HAS_GEOIP
ImportError: cannot import name HAS_GEOIP
2

There are 2 best solutions below

0
On

The answer is here:
https://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoip/#module-django.contrib.gis.geoip

In Django 1.6 the import needed has changed from:
from django.contrib.gis.utils import HAS_GEOIP

to:
from django.contrib.gis.geoip import HAS_GEOIP

1
On

You could try to install development version of django-tracking with

pip install git+https://github.com/bashu/django-tracking.git