我得到了 「不能導入名稱GeoIP的」 錯誤從瀏覽器,但不是在蟒蛇終端。例如/ tmp/geo中的地理數據。在python終端下面的作品。
from django.contrib.gis.geoip import GeoIP
GeoIP(path='/tmp/geo/')
然而,在一個Django視圖下面給出了錯誤
from django.contrib.gis.geoip import GeoIP
return HttpResponse (GeoIP(path='/tmp/geo/'))
任何指針將是有益的。我使用的是django 1.4,python 2.6。這是痕跡。謝謝。
Traceback:
File "/usr/lib/python2.6/site-packages/django/core/handlers/base.py" in get_response
101. request.path_info)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve
300. sub_match = pattern.resolve(new_path)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in resolve
209. return ResolverMatch(self.callback, args, kwargs, self.name)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in callback
216. self._callback = get_callable(self._callback_str)
File "/usr/lib/python2.6/site-packages/django/utils/functional.py" in wrapper
27. result = func(*args)
File "/usr/lib/python2.6/site-packages/django/core/urlresolvers.py" in get_callable
92. lookup_view = getattr(import_module(mod_name), func_name)
File "/usr/lib/python2.6/site-packages/django/utils/importlib.py" in import_module
35. __import__(name)
File "/x/y/z/views.py" in <module>
12. from django.contrib.gis.utils import GeoIP
Exception Type: ImportError at/
Exception Value: cannot import name GeoIP
試圖「從django.contrib.gis.utils.geoip進口GeoIP的」不工作,要麼 – user1783848
@NathanVillaescusa我覺得這是沒有更長的真正的django 1.4 –