{"title":"Geolocation with GeoIP","version":"1.9","locale":"es","docname":"ref/contrib/gis/geoip","url":"/es/1.9/ref/contrib/gis/geoip/","canonical":"https://djangodocs.dev/es/1.9/ref/contrib/gis/geoip/","summary":"Deprecated since Django 1.9 Obsoleto desde la versión 1.9: This module is deprecated in favor of django.contrib.gis.geoip2 , which supports IPv6 and the GeoLite2…","html":"<span id=\"geolocation-with-geoip\"></span><h1>Geolocation with GeoIP<a class=\"heading-anchor\" href=\"#module-django.contrib.gis.geoip\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h1>\n<aside class=\"version-note version-deprecated\" data-version=\"1.9\">\n<p class=\"version-note-title\">Deprecated since Django 1.9</p><p><span class=\"versionmodified deprecated\">Obsoleto desde la versión 1.9: </span>This module is deprecated in favor of <a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geoip2/\"><span class=\"doc\">django.contrib.gis.geoip2</span></a>, which supports IPv6 and the GeoLite2 database\nformat.</p>\n</aside>\n<p>The <a class=\"reference internal\" href=\"#django.contrib.gis.geoip.GeoIP\" title=\"django.contrib.gis.geoip.GeoIP\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code></a> object is a ctypes wrapper for the\n<a class=\"reference external\" href=\"https://www.maxmind.com/app/c\">MaxMind GeoIP C API</a>. <a class=\"footnote-reference brackets\" href=\"#id6\" id=\"id1\" role=\"doc-noteref\"><span class=\"fn-bracket\">[</span>1<span class=\"fn-bracket\">]</span></a></p>\n<p>In order to perform IP-based geolocation, the <a class=\"reference internal\" href=\"#django.contrib.gis.geoip.GeoIP\" title=\"django.contrib.gis.geoip.GeoIP\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code></a> object requires\nthe GeoIP C library and either the GeoIP <a class=\"reference external\" href=\"https://www.maxmind.com/app/country\">Country</a> or <a class=\"reference external\" href=\"https://www.maxmind.com/app/city\">City</a>\ndatasets in binary format (the CSV files will not work!).  These datasets may be\n<a class=\"reference external\" href=\"https://www.maxmind.com/download/geoip/database/\">downloaded from MaxMind</a>.  Grab the <code class=\"docutils literal notranslate\"><span class=\"pre\">GeoLiteCountry/GeoIP.dat.gz</span></code> and\n<code class=\"docutils literal notranslate\"><span class=\"pre\">GeoLiteCity.dat.gz</span></code> files and unzip them in a directory corresponding to what\nyou set <a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geoip2/#std-setting-GEOIP_PATH\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">GEOIP_PATH</span></code></a> with in your settings.  See the example and\nreference below for more details.</p>\n<section id=\"example\">\n<h2>Example<a class=\"heading-anchor\" href=\"#example\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<p>Assuming you have the GeoIP C library installed, here is an example of its\nusage:</p>\n<div class=\"code-block\" data-language=\"default\"><div class=\"code-block-toolbar\"><span class=\"code-block-language\">Code</span><button type=\"button\" class=\"copy-button\" data-copy hidden><span class=\"copy-button-label\">Copy</span></button></div><pre role=\"group\" tabindex=\"0\" aria-label=\"Code code\"><code><span class=\"gp\">&gt;&gt;&gt; </span><span class=\"kn\">from</span><span class=\"w\"> </span><span class=\"nn\">django.contrib.gis.geoip</span><span class=\"w\"> </span><span class=\"kn\">import</span> <span class=\"n\">GeoIP</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">g</span> <span class=\"o\">=</span> <span class=\"n\">GeoIP</span><span class=\"p\">()</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">g</span><span class=\"o\">.</span><span class=\"n\">country</span><span class=\"p\">(</span><span class=\"s1\">&#39;google.com&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">{&#39;country_code&#39;: &#39;US&#39;, &#39;country_name&#39;: &#39;United States&#39;}</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">g</span><span class=\"o\">.</span><span class=\"n\">city</span><span class=\"p\">(</span><span class=\"s1\">&#39;72.14.207.99&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">{&#39;area_code&#39;: 650,</span>\n<span class=\"go\">&#39;city&#39;: &#39;Mountain View&#39;,</span>\n<span class=\"go\">&#39;country_code&#39;: &#39;US&#39;,</span>\n<span class=\"go\">&#39;country_code3&#39;: &#39;USA&#39;,</span>\n<span class=\"go\">&#39;country_name&#39;: &#39;United States&#39;,</span>\n<span class=\"go\">&#39;dma_code&#39;: 807,</span>\n<span class=\"go\">&#39;latitude&#39;: 37.419200897216797,</span>\n<span class=\"go\">&#39;longitude&#39;: -122.05740356445312,</span>\n<span class=\"go\">&#39;postal_code&#39;: &#39;94043&#39;,</span>\n<span class=\"go\">&#39;region&#39;: &#39;CA&#39;}</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">g</span><span class=\"o\">.</span><span class=\"n\">lat_lon</span><span class=\"p\">(</span><span class=\"s1\">&#39;salon.com&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">(37.789798736572266, -122.39420318603516)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">g</span><span class=\"o\">.</span><span class=\"n\">lon_lat</span><span class=\"p\">(</span><span class=\"s1\">&#39;uh.edu&#39;</span><span class=\"p\">)</span>\n<span class=\"go\">(-95.415199279785156, 29.77549934387207)</span>\n<span class=\"gp\">&gt;&gt;&gt; </span><span class=\"n\">g</span><span class=\"o\">.</span><span class=\"n\">geos</span><span class=\"p\">(</span><span class=\"s1\">&#39;24.124.1.80&#39;</span><span class=\"p\">)</span><span class=\"o\">.</span><span class=\"n\">wkt</span>\n<span class=\"go\">&#39;POINT (-95.2087020874023438 39.0392990112304688)&#39;</span>\n</code></pre></div>\n</section>\n<section id=\"geoip-settings\">\n<h2><code class=\"docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code> Settings<a class=\"heading-anchor\" href=\"#geoip-settings\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"geoip-path\">\n<span id=\"std-setting-GEOIP_PATH\"></span><h3><code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_PATH</span></code><a class=\"heading-anchor\" href=\"#geoip-path\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A string specifying the directory where the GeoIP data files are\nlocated.  This setting is <em>required</em> unless manually specified\nwith <code class=\"docutils literal notranslate\"><span class=\"pre\">path</span></code> keyword when initializing the <a class=\"reference internal\" href=\"#django.contrib.gis.geoip.GeoIP\" title=\"django.contrib.gis.geoip.GeoIP\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code></a> object.</p>\n</section>\n<section id=\"geoip-library-path\">\n<span id=\"std-setting-GEOIP_LIBRARY_PATH\"></span><h3><code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_LIBRARY_PATH</span></code><a class=\"heading-anchor\" href=\"#geoip-library-path\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>A string specifying the location of the GeoIP C library.  Typically,\nthis setting is only used if the GeoIP C library is in a non-standard\nlocation (e.g., <code class=\"docutils literal notranslate\"><span class=\"pre\">/home/sue/lib/libGeoIP.so</span></code>).</p>\n</section>\n<section id=\"geoip-country\">\n<span id=\"std-setting-GEOIP_COUNTRY\"></span><h3><code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_COUNTRY</span></code><a class=\"heading-anchor\" href=\"#geoip-country\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The basename to use for the GeoIP country data file.\nDefaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">'GeoIP.dat'</span></code>.</p>\n</section>\n<section id=\"geoip-city\">\n<span id=\"std-setting-GEOIP_CITY\"></span><h3><code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_CITY</span></code><a class=\"heading-anchor\" href=\"#geoip-city\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>The basename to use for the GeoIP city data file.\nDefaults to <code class=\"docutils literal notranslate\"><span class=\"pre\">'GeoLiteCity.dat'</span></code>.</p>\n</section>\n</section>\n<section id=\"geoip-api\">\n<h2><code class=\"docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code> API<a class=\"heading-anchor\" href=\"#geoip-api\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<dl class=\"py class\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP\">\n<em class=\"property\"><span class=\"k\"><span class=\"pre\">class</span></span><span class=\"w\"> </span></em><span class=\"sig-name descname\"><span class=\"pre\">GeoIP</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">path</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">None</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">cache</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">0</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">country</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">None</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">city</span></span><span class=\"o\"><span class=\"pre\">=</span></span><span class=\"default_value\"><span class=\"pre\">None</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>The <code class=\"docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code> object does not require any parameters to use the default\nsettings.  However, at the very least the <a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geoip2/#std-setting-GEOIP_PATH\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">GEOIP_PATH</span></code></a> setting\nshould be set with the path of the location of your GeoIP data sets.  The\nfollowing initialization keywords may be used to customize any of the\ndefaults.</p>\n<div class=\"table-scroll\" role=\"region\" tabindex=\"0\" aria-label=\"Table\"><table class=\"docutils align-default\">\n<thead>\n<tr class=\"row-odd\"><th class=\"head\"><p>Keyword Arguments</p></th>\n<th class=\"head\"><p>Description</p></th>\n</tr>\n</thead>\n<tbody>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\"><span class=\"pre\">path</span></code></p></td>\n<td><p>Base directory to where GeoIP data is located or the\nfull path to where the city or country data files\n(.dat) are located.  Assumes that both the city and\ncountry data sets are located in this directory;\noverrides the <a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geoip2/#std-setting-GEOIP_PATH\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">GEOIP_PATH</span></code></a> settings attribute.</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\"><span class=\"pre\">cache</span></code></p></td>\n<td><p>The cache settings when opening up the GeoIP datasets,\nand may be an integer in (0, 1, 2, 4) corresponding to\nthe <code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_STANDARD</span></code>, <code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_MEMORY_CACHE</span></code>,\n<code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_CHECK_CACHE</span></code>, and <code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_INDEX_CACHE</span></code>\n<code class=\"docutils literal notranslate\"><span class=\"pre\">GeoIPOptions</span></code> C API settings, respectively.\nDefaults to 0 (<code class=\"docutils literal notranslate\"><span class=\"pre\">GEOIP_STANDARD</span></code>).</p></td>\n</tr>\n<tr class=\"row-even\"><td><p><code class=\"docutils literal notranslate\"><span class=\"pre\">country</span></code></p></td>\n<td><p>The name of the GeoIP country data file.  Defaults\nto <code class=\"docutils literal notranslate\"><span class=\"pre\">GeoIP.dat</span></code>.  Setting this keyword overrides the\n<a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geoip2/#std-setting-GEOIP_COUNTRY\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">GEOIP_COUNTRY</span></code></a> settings attribute.</p></td>\n</tr>\n<tr class=\"row-odd\"><td><p><code class=\"docutils literal notranslate\"><span class=\"pre\">city</span></code></p></td>\n<td><p>The name of the GeoIP city data file.  Defaults to\n<code class=\"docutils literal notranslate\"><span class=\"pre\">GeoLiteCity.dat</span></code>.  Setting this keyword overrides\nthe <a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geoip2/#std-setting-GEOIP_CITY\"><code class=\"xref std std-setting docutils literal notranslate\"><span class=\"pre\">GEOIP_CITY</span></code></a> settings attribute.</p></td>\n</tr>\n</tbody>\n</table>\n</div>\n</section>\n<section id=\"geoip-methods\">\n<h2><code class=\"docutils literal notranslate\"><span class=\"pre\">GeoIP</span></code> Methods<a class=\"heading-anchor\" href=\"#geoip-methods\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h2>\n<section id=\"querying\">\n<h3>Querying<a class=\"heading-anchor\" href=\"#querying\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>All the following querying routines may take either a string IP address\nor a fully qualified domain name (FQDN).  For example, both\n<code class=\"docutils literal notranslate\"><span class=\"pre\">'205.186.163.125'</span></code> and <code class=\"docutils literal notranslate\"><span class=\"pre\">'djangoproject.com'</span></code> would be valid query\nparameters.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.city\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">city</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.city\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns a dictionary of city information for the given query.  Some\nof the values in the dictionary may be undefined (<code class=\"docutils literal notranslate\"><span class=\"pre\">None</span></code>).</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns a dictionary with the country code and country for the given\nquery.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_code\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_code</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_code\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns only the country code corresponding to the query.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_name\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_name</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_name\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns only the country name corresponding to the query.</p>\n</section>\n<section id=\"coordinate-retrieval\">\n<h3>Coordinate Retrieval<a class=\"heading-anchor\" href=\"#coordinate-retrieval\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.coords\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">coords</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.coords\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns a coordinate tuple of (longitude, latitude).</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.lon_lat\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">lon_lat</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.lon_lat\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns a coordinate tuple of (longitude, latitude).</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.lat_lon\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">lat_lon</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.lat_lon\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns a coordinate tuple of (latitude, longitude),</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.geos\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">geos</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.geos\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>Returns a <a class=\"reference internal\" href=\"/es/1.9/ref/contrib/gis/geos/#django.contrib.gis.geos.Point\" title=\"django.contrib.gis.geos.Point\"><code class=\"xref py py-class docutils literal notranslate\"><span class=\"pre\">django.contrib.gis.geos.Point</span></code></a> object corresponding to the query.</p>\n</section>\n<section id=\"database-information\">\n<h3>Database Information<a class=\"heading-anchor\" href=\"#database-information\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_info\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_info</span></span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_info\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>This property returns information about the GeoIP country database.</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.city_info\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">city_info</span></span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.city_info\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>This property returns information about the GeoIP city database.</p>\n<dl class=\"py attribute\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.info\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">info</span></span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.info\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>This property returns information about all GeoIP databases (both city\nand country), and the version of the GeoIP C library (if supported).</p>\n</section>\n<section id=\"geoip-python-api-compatibility-methods\">\n<h3>GeoIP-Python API compatibility methods<a class=\"heading-anchor\" href=\"#geoip-python-api-compatibility-methods\"><span class=\"visually-hidden\">Link to this heading</span><span aria-hidden=\"true\">#</span></a></h3>\n<p>These methods exist to ease compatibility with any code using MaxMind’s\nexisting Python API.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.open\">\n<em class=\"property\"><span class=\"k\"><span class=\"pre\">classmethod</span></span><span class=\"w\"> </span></em><span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">open</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">path</span></span></em>, <em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">cache</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.open\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p>This classmethod instantiates the GeoIP object from the given database path\nand given cache setting.</p>\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.region_by_addr\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">region_by_addr</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.region_by_addr\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.region_by_name\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">region_by_name</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.region_by_name\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.record_by_addr\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">record_by_addr</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.record_by_addr\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.record_by_name\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">record_by_name</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.record_by_name\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_code_by_addr\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_code_by_addr</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_code_by_addr\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_code_by_name\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_code_by_name</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_code_by_name\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_name_by_addr\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_name_by_addr</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_name_by_addr\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<dl class=\"py method\">\n<dt class=\"sig sig-object py\" id=\"django.contrib.gis.geoip.GeoIP.country_name_by_name\">\n<span class=\"sig-prename descclassname\"><span class=\"pre\">GeoIP.</span></span><span class=\"sig-name descname\"><span class=\"pre\">country_name_by_name</span></span><span class=\"sig-paren\">(</span><em class=\"sig-param\"><span class=\"n\"><span class=\"pre\">query</span></span></em><span class=\"sig-paren\">)</span><a class=\"heading-anchor\" href=\"#django.contrib.gis.geoip.GeoIP.country_name_by_name\"><span class=\"visually-hidden\">Link to this definition</span><span aria-hidden=\"true\">#</span></a></dt>\n<dd></dd></dl>\n\n<p class=\"rubric\">Footnotes</p>\n<aside class=\"footnote-list brackets\">\n<aside class=\"footnote brackets\" id=\"id6\" role=\"doc-footnote\">\n<span class=\"label\"><span class=\"fn-bracket\">[</span><a role=\"doc-backlink\" href=\"#id1\">1</a><span class=\"fn-bracket\">]</span></span>\n<p>GeoIP(R) is a registered trademark of MaxMind, LLC of Boston, Massachusetts.</p>\n</aside>\n</aside>\n</section>\n</section>","rootId":"module-django.contrib.gis.geoip","toc":[{"title":"Example","anchor":"example","children":[]},{"title":"GeoIP Settings","anchor":"geoip-settings","children":[{"title":"GEOIP_PATH","anchor":"geoip-path","children":[]},{"title":"GEOIP_LIBRARY_PATH","anchor":"geoip-library-path","children":[]},{"title":"GEOIP_COUNTRY","anchor":"geoip-country","children":[]},{"title":"GEOIP_CITY","anchor":"geoip-city","children":[]}]},{"title":"GeoIP API","anchor":"geoip-api","children":[]},{"title":"GeoIP Methods","anchor":"geoip-methods","children":[{"title":"Querying","anchor":"querying","children":[]},{"title":"Coordinate Retrieval","anchor":"coordinate-retrieval","children":[]},{"title":"Database Information","anchor":"database-information","children":[]},{"title":"GeoIP-Python API compatibility methods","anchor":"geoip-python-api-compatibility-methods","children":[]}]}],"breadcrumbs":[{"docname":"ref/index","title":"API Reference","url":"/es/1.9/ref/"},{"docname":"ref/contrib/index","title":"contrib packages","url":"/es/1.9/ref/contrib/"},{"docname":"ref/contrib/gis/index","title":"GeoDjango","url":"/es/1.9/ref/contrib/gis/"}],"prev":{"docname":"ref/contrib/gis/gdal","title":"GDAL API","url":"/es/1.9/ref/contrib/gis/gdal/"},"next":{"docname":"ref/contrib/gis/geoip2","title":"Geolocation with GeoIP2","url":"/es/1.9/ref/contrib/gis/geoip2/"},"formats":{"html":"/es/1.9/ref/contrib/gis/geoip/","markdown":"/es/1.9/ref/contrib/gis/geoip.md","json":"/es/1.9/ref/contrib/gis/geoip.json"},"source":"https://github.com/django/django/blob/stable/1.9.x/docs/ref/contrib/gis/geoip.txt","official":"https://docs.djangoproject.com/es/1.9/ref/contrib/gis/geoip/","inVersions":["1.11","1.10","1.9"],"inLocales":["en","fr","ja","id","pt-br","es"]}