Source

django-ipgeo /

Filename Size Date modified Message
ipgeo
70 B
59 B
1.5 KB
0 B
640 B
56 B
875 B

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