maxmind / GeoIP2-python

Python code for GeoIP2 webservice client and database reader
https://geoip2.readthedocs.org/en/latest/
Apache License 2.0
1.1k stars 140 forks source link

error when running GeoIP2 in GeoDjango project #167

Closed iamlauriano closed 5 months ago

iamlauriano commented 5 months ago

I'm testing geoIP2 in conjunction with GeoDjango https://docs.djangoproject.com/en/5.0/ref/contrib/gis/geoip2/

I installed GeoIP2, according to the documentation https://pypi.org/project/geoip2/

However, it presents this error when calling the service

import geoip2.database g = GeoIP2() Traceback (most recent call last): File "", line 1, in File "/home/lauriano/lauriano88/bamburralrural/venv/lib/python3.10/site-packages/django/contrib/gis/geoip2/base.py", line 78, in init raise GeoIP2Exception( django.contrib.gis.geoip2.base.GeoIP2Exception: GeoIP path must be provided via parameter or the GEOIP_PATH setting.

oschwald commented 5 months ago

I think this would be better directed at the Django project. It sounds like GEOIP_PATH has to be set. The error is not from the code in this library.