1. Gregory Petukhov
  2. django-ipgeo

Overview

django-ipgeo application

What is this?

django-ipgeo provides API to work with database from ipgeobase.ru

How to use it?

  • Install via pip django-ipgeo package.

  • Add "ipgeo" to INSTALLED_APPS

  • Run syncdb

  • Run "manage.py ipgeo_update"

  • Use it like:

    from ipgeo.models import Range

    try:

    rang = Range.objects.find(request.META['REMOTE_ADDR']

    except Range.DoesNotExist:

    print 'Unknown location'

    else:

    print 'The country is', rang.country if rang.location:

    print 'The city is', rang.location.name