je n'arrive pas à trouver une solution pour une application qui me mesure la distance entre le locale et la position du client django.contrib.gis.geoip2.base.GeoIP2Exception: Could not load a database from ...
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 setting.py INSTALLED_APPS = [ 'django.contrib.gis.geoip2', ] GEOIP_PATH = os.path.join(BASE_DIR, 'geoip') utils.py from django.contrib.gis.geoip2 import GeoIP2 def get_geo(ip): g=GeoIP2() country=g.country(ip) city=g.city(ip) lat,lon=g.lat_lon(ip) return country, city, lat, lon
Partager