skip to navigation
skip to content

django-countries-plus 0.2

A django model & fixture containing all data from the countries table of

Latest Version: 1.2.1


django-countries-plus provides a model and fixture containing all top level country data from (

This package also provides a convenience middleware that will look up a country in the database using a defined meta header, ex: the Cloudflare provided geoip META header HTTP_CF_IPCOUNTRY. This country object will be
attached to the request object at

The model provides the following fields (original column name in parentheses).

* iso (ISO)
* iso3 (ISO3)
* iso_numeric (ISO-Numeric)
* fips (fips)
* name (Country)
* capital
* area (Area(in sq km))
* population (population)
* continent (continent)
* tld (tld)
* currency_code (CurrencyCode)
* currency_name (CurrencyName)
* phone (Phone)
* postal_code_format (Postal Code Format)
* postal_code_regex (Postal Code Regex)
* languages (Languages)
* geonameid (geonameid)
* neighbors (neighbours)
* equivalent_fips_code (EquivalentFipsCode)



pip install django-countries-plus


1. Add ``countries_plus`` to your INSTALLED_APPS

2. Sync your fixtures::

python syncdb

3. In your code use::

from countries_plus.models import Country
usa = Country.objects.get(iso3='USA')

Enbling the optional middleware::

1. Follow steps 1 & 2 above.

2. Add 'countries_plus.middleware.AddRequestCountryMiddleware' to your middleware.

3. add the following two settings:
COUNTRIES_PLUS_COUNTRY_HEADER - A string defining the name of the meta header that provides the country code. Ex: 'HTTP_CF_COUNTRY' (from

COUNTRIES_PLUS_DEFAULT_ISO - A string containing an iso code for the country you want to use as a fallback in the case of a missing or malformed geoip header. Ex: 'US' or 'DE' or 'BR'  
File Type Py Version Uploaded on Size (md5) Source 2014-05-23 37KB