This is an unofficial Heroku buildpack that installs the latest GeoLite2 City and Country free IP geolocation databases from MaxMind along with the libmaxminddb C library for fast lookups in the databases.
Note an older version of the Country database is available in any Heroku deploy via the packages
libgeoip1 listed on https://devcenter.heroku.com/articles/stack-packages
The GeoLite2 databases are distributed under the Creative Commons Attribution-ShareAlike 4.0 International License. The official download page suggests the attribution requirement may be met by including the following in all advertising and documentation mentioning features of or use of the databases:
This product includes GeoLite2 data created by MaxMind, available from <a href="http://www.maxmind.com">http://www.maxmind.com</a>.
$ heroku buildpacks:add https://github.com/HiMamaInc/heroku-buildpack-geoip-geolite2.git
MAXMIND_LICENSE_KEY environment variable to settings, as per MaxMind's blog post
Add to your
GEOIP_PATH=os.environ['GEOIP_GEOLITE2_PATH'] GEOIP_CITY=os.environ['GEOIP_GEOLITE2_CITY_FILENAME'] GEOIP_COUNTRY=os.environ['GEOIP_GEOLITE2_COUNTRY_FILENAME']
See https://docs.djangoproject.com/en/1.11/ref/contrib/gis/geoip2/ for installing the
geoip2 Python library and usage examples.
Copy the snippet above into CLI.