django-geoipdb-loader

Helps download and keep updated maxmind's geoip db required for django GeoIP


Keywords
django, geoip
License
BSD-3-Clause
Install
pip install django-geoipdb-loader==0.9.0

Documentation

Django GeoIP DB Loader

tests
Travis-Ci Build Status Coverage Status

Helps download and keep updated maxmind's geoip db required for django GeoIP

For Django 2.2+ and python 3.6+. For older versions use pip install django-geoipdb-loader<1.0.

Why and when to use?

If you don't mind installing and configuring official geoipupdate on your server then I'd recommend to use it. If you want a simple method to download db files via django command or schedule updates using celery then this app is the way to go.

Installation

Using pip:

pip install django-geoipdb-loader

Add the app to INSTALLED_APPS and configure GEOIP_PATH:

INSTALLED_APPS = [
    ...
    geoipdb_loader,
    ...
]

GEOIP_PATH = '/myproject/geoip'
MAXMIND_LICENSE_KEY = 'your license key'

Usage

Run manage.py download_geoipdb to download geoip files.

In order to automatically update the geoip files you can use provided celery task:

CELERYBEAT_SCHEDULE = {
    'update-geoipdb': {
        'task': 'geoipdb_loader.tasks.update_geoipdb',
        'schedule': crontab(day_of_week=6),
    },
}

or crontab:

* * * * 6 manage.py download_geoipdb