Under the hood

Data storage

All geoip data, including geography and geoip mapping is stored in the database. To avoid unnecessary database hits user location is stored in a cookie.

Geography

Django-geoip-redis supports only ipgeobase geography, which consist of following entities: Country, Region, City. Database maintains normalized relationships between all entities, i.e. Country has many Regions, Region has many Cities, ISP has many Country, Provider has many ISP.

class geoip.models.Country(*args, **kwargs)

Country(code, name)

class geoip.models.Area(*args, **kwargs)

Area(id, country_id, name)

class geoip.models.City(*args, **kwargs)

City(id, area_id, name, latitude, longitude)

class geoip.models.ISP(*args, **kwargs)

ISP(id, name, country_id)

class geoip.models.Provider(*args, **kwargs)

Provider(id, name, ranges)

IP ranges

class geoip.models.Range(*args, **kwargs)

Range(id, start_ip, end_ip, country_id, area_id, city_id, isp_id, provider_id)

Backends

There is currently no infrastructure to use alternative geoip backends, but it’s planned for future releases. Pull requests are also welcome.

Ipgeobase backend

ipgeobase.ru is a database of Russian and Ukranian IP networks mapped to geographical locations.

It’s maintained by RuCenter and updated daily.

As of 11 Nov 2013 it contains info on 992 cities and 152333 Ip Ranges (some networks doesn’t belong to CIS).

Here a is demo of ip detection: http://ipgeobase.ru/

Table Of Contents

Previous topic

Usage

Next topic

Updating GeoIP database

This Page