Skip to content

App to figure out where your visitors are from by their IP address. Based on default DB or Redis.

License

Notifications You must be signed in to change notification settings

gotlium/django-geoip-redis

Repository files navigation

Django-GeoIP-Redis

Build Status https://coveralls.io/repos/gotlium/django-geoip-redis/badge.png?branch=master Current version on PyPi Downloads from PyPi

Documentation available at Read the Docs.

Demo installation:

$ sudo apt-get install redis-server virtualenvwrapper
$ mkvirtualenv django-geoip-redis
$ git clone https://github.com/gotlium/django-geoip-redis.git
$ cd django-geoip-redis
$ pip install -r requirements/package.txt
$ python setup.py develop
$ cd demo
$ pip install -r requirements.txt
$ python manage.py syncdb --noinput
$ python manage.py migrate
$ python manage.py loaddata ../fixtures/db.json
$ python manage.py shell
>>> from geoip.geo import record_by_ip_as_dict
>>> print (record_by_ip_as_dict('91.195.136.52'))

If you want use native db for local development, you can add GEO_BACKEND = 'db' into local_settings.py

Performance:

  • django-geoip-redis:
    • MySQL(SSD): 728 rps
    • SQLite(SSD): 46 rps
    • Redis: 3548 rps
  • django-geoip(no isp, no provider):
    • MySQL(SSD): 855 rps
    • SQLite(SSD): 47 rps
  • django.contrib.gis.geoip.GeoIP(no isp, no provider, but C API):
    • standard: 4666 rps
    • memory: 73 rps
    • check: 4510 rps
    • index: 76 rps
    • mmap: 4425 rps

Tested on Ubuntu 12.04(x86_64), Django(1.6), uWSGI(1.0.3), Nginx(1.1.19) with Apache Benchmark:

$ ab -c 100 -n 1000 http://localhost/ip/91.195.136.52/
On tests used default configuration for Redis & MySQL without any modifications.

Demo page available here.

Compatibility:

  • Python: 2.6, 2.7, 3.3
  • Django: 1.3.x, 1.4.x, 1.5.x, 1.6
Bitdeli badge

About

App to figure out where your visitors are from by their IP address. Based on default DB or Redis.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages