From: Tapio Rantala <tapio.rantala@iki.fi>
Date: Sun, 11 Oct 2015 11:43:20 +1100
Subject: Use Debian GeoIP database path as default

 Default to Debian standard path for GeoIP directory and for GeoIP city
 file. Avoids the need to declare them in each project.
 .
 This is a Debian specific patch.
Bug-Debian: http://bugs.debian.org/645094
Forwarded: not-needed

Patch-Name: 06_use_debian_geoip_database_as_default.diff
---
 django/contrib/gis/geoip2/base.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/django/contrib/gis/geoip2/base.py b/django/contrib/gis/geoip2/base.py
index b360f12a4882..a8b7b9e22dfb 100644
--- a/django/contrib/gis/geoip2/base.py
+++ b/django/contrib/gis/geoip2/base.py
@@ -55,6 +55,7 @@ class GeoIP2:
             to where the city or country data files (*.mmdb) are located.
             Assumes that both the city and country data sets are located in
             this directory; overrides the GEOIP_PATH setting.
+            If neither is set, defaults to '/usr/share/GeoIP'.
 
         * cache: The cache settings when opening up the GeoIP datasets. May be
             an integer in (0, 1, 2, 4, 8) corresponding to the MODE_AUTO,
@@ -64,16 +65,18 @@ class GeoIP2:
 
         * country: The name of the GeoIP country data file. Defaults to
             'GeoLite2-Country.mmdb'; overrides the GEOIP_COUNTRY setting.
+            If neither is set, defaults to 'GeoIP.dat'.
 
         * city: The name of the GeoIP city data file. Defaults to
             'GeoLite2-City.mmdb'; overrides the GEOIP_CITY setting.
+            If neither is set, defaults to 'GeoIPCity.dat'.
         """
         # Checking the given cache option.
         if cache not in self.cache_options:
             raise GeoIP2Exception("Invalid GeoIP caching option: %s" % cache)
 
         # Getting the GeoIP data path.
-        path = path or GEOIP_SETTINGS["GEOIP_PATH"]
+        path = path or GEOIP_SETTINGS.get('GEOIP_PATH', '/usr/share/GeoIP')
         if not path:
             raise GeoIP2Exception(
                 "GeoIP path must be provided via parameter or the GEOIP_PATH setting."
@@ -84,12 +87,12 @@ class GeoIP2:
             # Constructing the GeoIP database filenames using the settings
             # dictionary. If the database files for the GeoLite country
             # and/or city datasets exist, then try to open them.
-            country_db = path / (country or GEOIP_SETTINGS["GEOIP_COUNTRY"])
+            country_db = path / (country or GEOIP_SETTINGS.get('GEOIP_COUNTRY', 'GeoIP.dat'))
             if country_db.is_file():
                 self._country = geoip2.database.Reader(str(country_db), mode=cache)
                 self._country_file = country_db
 
-            city_db = path / (city or GEOIP_SETTINGS["GEOIP_CITY"])
+            city_db = path / (city or GEOIP_SETTINGS.get('GEOIP_CITY', 'GeoIPCity.dat'))
             if city_db.is_file():
                 self._city = geoip2.database.Reader(str(city_db), mode=cache)
                 self._city_file = city_db
