from geoip import geoip
r = geoip.GeoIp()
r.load_memory()
r.resolve('12.12.12.12').country_code
print(r.resolve('123.44.57.4'))
r.resolve2('12.12.12.12')
How to detect the country and city of a user accessing your site?