Skip to content

Installation

Basic Installation

Install django-countries using pip:

pip install django-countries

Optional: Better Unicode Sorting

For more accurate sorting of translated country names, install with the optional pyuca package:

pip install django-countries[pyuca]

This improves sorting for non-ASCII country names by using the Unicode Collation Algorithm.

Django Configuration

Add django_countries to your INSTALLED_APPS:

INSTALLED_APPS = [
    # ...
    'django_countries',
    # ...
]

Verify Installation

You can verify the installation by running:

>>> from django_countries import countries
>>> countries['NZ']
'New Zealand'

Next Steps