skillfed

django-countries

Provides a country field for Django models.

django-countries v9.0.0 2.3M downloads/30d#3,134 on PyPI1,532
Permissive license MIT Active released

What it is and what it does

django-countries is a Django application that adds a reusable country field to your models, backed by the ISO 3166-1 standard. It ships with static flag icon files, automatic translation of country names via Django's i18n system, and built-in support for Django REST Framework and graphene-django. The package has been in active development since 2014 and is currently maintained for modern Django and Python versions.

You use it by adding the app to INSTALLED_APPS and then importing CountryField into your models. It handles country validation, serialization, and rendering out of the box. The field integrates cleanly with Django forms and the REST Framework, so you get country dropdowns and API representations without extra glue code.

Use it for:

  • Add a country selector to user profiles or address forms with automatic flag display and translated country names.
  • Build REST APIs that accept and return country data with proper serialization and validation.
  • Store and query country information in multi-tenant or international applications without managing your own country list.
  • Support multiple country selection in a single model field for applications that need to track regions or service areas.
  • Localize country names in different languages automatically using Django's translation framework.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides a Django model field for storing country data with built-in support for ISO 3166-1 countries, translated names, flag icons, and REST Framework integration.

Yes. django-countries is a mature, actively maintained package with low install friction, permissive licensing, no known vulnerabilities, and solid support for current Django and Python versions. Install it if you need country fields in Django models; the time saved on country data management and REST Framework integration justifies the dependency.

Install

django-countries on PyPI

pip

pip install django-countries

uv

uv add django-countries

poetry

poetry add django-countries

Installing django-countries

Before you install

Low install friction with only two runtime dependencies (asgiref, typing-extensions). Active maintenance with recent commits and a stable production status across Python 3.10–3.14 and Django 4.2, 5.2, and 6.0.

License in practice

MIT license (permissive) means you can use this package freely in commercial and private projects with minimal restrictions.

Quickstart

pip install django-countries

# In Django settings.py
INSTALLED_APPS = [
    'django_countries',
]

# In your model
from django_countries.fields import CountryField

class Person(models.Model):
    country = CountryField()

Requires Django 4.2 or later and Python 3.10 or later.

Verify before relying

  • Whether translated country names cover all supported languages or a subset of common locales.
  • Performance characteristics when handling large datasets with country field queries.
  • Exact scope of GraphQL support and whether it requires additional dependencies beyond graphene-django.

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 2 — asgiref, typing-extensions
Maintenance actively maintained — 65 days since the last release
Last repo commit
First released
Downloads 2,329,133/month — #3,134 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: django_countries-9.0.0-py3-none-any.whl

Keywords: django, countries, flags

Development Status :: 5 - Production/StableEnvironment :: Web EnvironmentFramework :: DjangoFramework :: Django :: 4.2Framework :: Django :: 5.2Framework :: Django :: 6.0Intended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14

Tags

django country fieldcountry selection djangoflag icons djangodjango rest framework countriesiso 3166 djangomultilingual country namesdjango model country
django-orminternationalizationrest-api

More Dynamic Content packages