我正在使用django 1.9.9。我想在我的项目中使用django-tracking模块。但是,当我尝试使用django-tracking时遇到以下错误消息:
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/tracking/models.py", line 5, in <module>
from django.contrib.gis.utils import HAS_GEOIP
ImportError: cannot import name HAS_GEOIP
sTraceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/tracking/models.py", line 5, in <module>
from django.contrib.gis.utils import HAS_GEOIP
ImportError: cannot import name HAS_GEOIP
&#13;
GeoIP模块已正确安装。我可以看到django在django.contrib.gis.utils中寻找HAS_GEOIP,但它应该在django.contrib.gis.geoip中查找。如何告诉django 1.9.9使用django.contrib.gis.geoip?
答案 0 :(得分:1)
使用django-tracking
分支按develop
升级。否则降级django
pip install git+https://github.com/bashu/django-tracking.git@develop