django-countries
Provides a country field for Django models.
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-countriesuv
uv add django-countriespoetry
poetry add django-countriesInstalling 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
Tags
More Dynamic Content packages
MarkupSafe provides a text object that escapes…
permissive · top 100 on PyPI
Jinja2Jinja2 is a templating engine that renders…
permissive · top 100 on PyPI
soupsieveSoupsieve is a CSS selector library designed to…
permissive · top 100 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
MakoMako compiles Python-embedded templates into…
permissive · top 1,000 on PyPI
country_listProvides ISO 3166-1 country codes and names in…
permissive · top 15,000 on PyPI
django-localflavorProvides country-specific form fields,…
permissive · top 5,000 on PyPI
pycountry-convertConverts between ISO country codes (alpha-2,…
permissive · top 15,000 on PyPI
iso3166Converts between ISO 3166-1 country codes…
permissive · top 5,000 on PyPI
pycountryProvides programmatic access to ISO standard…
copyleft · top 1,000 on PyPI
django-flagsDjango-Flags provides a feature flag system for…
permissive · top 15,000 on PyPI
django-phonenumber-fieldProvides a Django model field for storing,…
permissive · top 5,000 on PyPI
django-cities-lightProvides Django models and management commands…
permissive · top 15,000 on PyPI
countryinfoCountryinfo provides a Python interface to…
permissive · top 15,000 on PyPI
country-converterConverts and matches country names across…
copyleft · top 5,000 on PyPI