11.13. GeoLocation

The GeoLocation builtin plugin defines two database tables that are used by other modules:

  • Locations - maps location names to latitude and longitude
  • LocationIP - maps IP addresses or subnets to locations names

11.13.1. Admin Panel

Both databases are accessible via the Admin panel as shown below:


This allows you to add, modify or remove entries from the database. The “name” field between should be the same for the same locations.

11.13.2. Importing from the command line

Both databases can be imported from the command line using python manage.py locations:

$ python manage.py locations -h
Usage: manage.py locations [options] None

Manage locations

  Location Help:
    Helper commands to manange locations

                        Import Locations: location,latitude,longitude
                        Import Location / IP map: location,ip,mask
    --merge             Merge import file rather than replace

There are sample files in the example-configs directory. A snippet of each is shown below.

$ python manage.py locations --import-locations example-configs/sample_locations.txt
Imported 13 locations

$python manage.py locations --import-location-ip example-configs/sample_location_ip.txt
Imported 13 locations/ip entries Sample Locations

"NYC",40.7142700,-74.0059700 Sample Location-IP