neotam
neotam

Reputation: 2731

in python error while importing GeoIP on CentOs server

I am using Django, and when I am using the geoip package or importing GeoIP I am getting the following error on centos, while it is working well on ubuntu 12.04.

The error is as follows

 from django.contrib.gis.utils.geoip import GeoIP
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/django/contrib/gis/utils/geoip.py", line 67, in <module>
    'Try setting GEOIP_LIBRARY_PATH in your settings.' % lib_name)
django.contrib.gis.utils.geoip.GeoIPException: Could not find the GeoIP library (tried "GeoIP"). Try setting GEOIP_LIBRARY_PATH in your settings.

please try to help me out, I can't go further without this.

Upvotes: 1

Views: 502

Answers (2)

Petri
Petri

Reputation: 5006

The django geoip code is using the MaxMind free geoip data that is distributed in the form of a proprietary file-based 'database'. You're probably missing the rpm package for that, after which you can locate the shared library it provides & set the GEOIP_LIBRARY_PATH to point to it. Looks like there's both an example of setting the path and some packages for CentOS as well.

Upvotes: 0

Cameron Sparr
Cameron Sparr

Reputation: 3981

trying doing this on both of your systems:

$ echo $GEOIP_LIBRARY_PATH

and compare the output. From the error message, it sounds like you will get a directory path on Ubuntu, and make sure the same path is set up on CentOS, like so (on the centOS system):

$ export GEOIP_LIBRARY_PATH=$GEOIP_LIBRARY_PATH:<path returned from Ubuntu system>

Upvotes: 1

Related Questions