2

我正在尝试将 Django 1.3 应用程序转换为 Django 1.6。我正在使用django-tracking包,但是当我启动运行时,我收到以下错误:

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
4

2 回答 2

2

答案在这里:
https ://docs.djangoproject.com/en/1.4/ref/contrib/gis/geoip/#module-django.contrib.gis.geoip

在 Django 1.6 中,所需的导入已更改为:
from django.contrib.gis.utils import HAS_GEOIP

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

于 2013-12-24T05:48:08.390 回答
1

您可以尝试安装 django-tracking 的开发版本

pip install git+https://github.com/bashu/django-tracking.git
于 2015-12-30T04:21:21.027 回答