This seemingly has no fix, I've read up on the previous bug which was apparently fixed 5 years ago here. Basically I've done everything completely properly according to the documents in both Django and at MaxMind.
I have specified my GEOIP_PATH
, and have even tried specifying the files too using GEOIP_CITY
but I still get the same traceback:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/django/core/handlers/base.py", line 112, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/django/backend/apps/api/routes.py", line 98, in jsonp_wrapper
resp = f(request, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/django/views/decorators/csrf.py", line 57, in wrapped_view
return view_func(*args, **kwargs)
File "/home/django/backend/apps/api/routes.py", line 205, in userLogin
userProfile.updateLocation(request)
File "/home/django/backend/apps/agents/models.py", line 89, in updateLocation
location = locationFromRequest(request)
File "/home/django/backend/apps/agents/models.py", line 29, in locationFromRequest
return g.city(ip)
File "/usr/lib/python2.7/dist-packages/django/contrib/gis/geoip/base.py", line 159, in city
enc_query = self._check_query(query, city=True)
File "/usr/lib/python2.7/dist-packages/django/contrib/gis/geoip/base.py", line 148, in _check_query
raise GeoIPException('Invalid GeoIP city data file: %s' % self._city_file)
GeoIPException: Invalid GeoIP city data file
I'm just doing a simple test in a python shell to test using:
from django.contrib.gis.geoip import GeoIP
g = GeoIP()
g.city('google.com')
g.country('google.com')
<--- this works fine, note this problem is only with the CITY db I guess
I did install the GeoIP C Library from apt, using apt-get install libgeoip-dev
, which has apparently given me an older version 1.6.0-1
when the newest version is 1.6.2-1
. My Django version is 1.6.1 as well.