django-ourairports
A Django application to download and import aviation data from OurAirports.
Features
- Import airports, runways, frequencies, navaids, countries, and regions
- GeoDjango support for spatial queries
- Customizable import via plugin hooks
- Management command for easy data management
- Incremental updates with change detection
Requirements
- Python 3.10+
- Django 4.2+
- PostGIS (recommended) or SpatiaLite
- GDAL
Installation
pip install django-ourairports
Add to your INSTALLED_APPS:
INSTALLED_APPS = [
...
'django.contrib.gis',
'ourairports',
]
Run migrations:
python manage.py migrate ourairports
Quick Start
Import all data:
python manage.py ourairports --import=all
Import specific data types:
python manage.py ourairports --import=airport,runway
Flush and reimport:
python manage.py ourairports --flush=all --import=all
Configuration
Optional settings in settings.py:
OURAIRPORTS = {
# Directory for downloaded data files
'DATA_DIR': '/path/to/data',
# Cache duration in seconds (default: 86400 = 24 hours)
'CACHE_DURATION': 86400,
# Batch size for bulk operations
'BATCH_SIZE': 1000,
}
Models
Country
Country information with ISO codes and continent.
Region
Administrative regions (states, provinces) with ISO 3166-2 codes.
Airport
Airports with location, type, codes (IATA, ICAO/GPS), and metadata.
Runway
Runway details including dimensions, surface, lighting, and end coordinates.
Frequency
Radio frequencies (TWR, APP, ATIS, etc.) for airports.
Navaid
Navigation aids (VOR, NDB, DME, TACAN) with locations and frequencies.
Usage Examples
from ourairports.models import Airport, Country, Runway
# Find airports by IATA code
jfk = Airport.objects.get(iata_code='JFK')
# Find large airports in a country
us_large = Airport.objects.filter(
iso_country='US',
airport_type='large_airport'
)
# Airports with scheduled service
scheduled = Airport.objects.filter(scheduled_service=True)
# Find airports near a point (requires PostGIS)
from django.contrib.gis.geos import Point
from django.contrib.gis.measure import D
point = Point(-73.7781, 40.6413) # JFK coordinates
nearby = Airport.objects.filter(
location__distance_lte=(point, D(km=50))
)
# Get runways for an airport
runways = jfk.runways.all()
# Get frequencies for an airport
frequencies = jfk.frequencies.filter(frequency_type='TWR')
Management Command
# Show help
python manage.py ourairports --help
# Import all data
python manage.py ourairports --import=all
# Import specific types
python manage.py ourairports --import=country,region,airport
# Flush data before import
python manage.py ourairports --flush=airport --import=airport
# Force re-download (ignore cache)
python manage.py ourairports --import=all --force
# Dry run (parse without saving)
python manage.py ourairports --import=airport --dry-run
# Download only (no import)
python manage.py ourairports --download-only
# List cached files
python manage.py ourairports --list
# Clear cache
python manage.py ourairports --clear
Import Options
| Option | Description |
|---|---|
country |
Countries |
region |
Regions (states/provinces) |
airport |
Airports |
runway |
Runways |
frequency |
Radio frequencies |
navaid |
Navigation aids |
all |
All of the above |
Plugin System
Customize imports with hooks:
# yourapp/plugins.py
from ourairports.plugin import HookException
def airport_pre(row, importer):
"""Called before each airport is processed."""
# Skip closed airports
if row.get('type') == 'closed':
raise HookException("Skipping closed airport")
return row
def airport_post(airport, row, importer):
"""Called after each airport is saved."""
# Add custom processing
pass
Register in settings:
OURAIRPORTS = {
'PLUGINS': ['yourapp.plugins'],
}
Data Source
Data is sourced from OurAirports, a community-maintained database of airports worldwide. The data is released to the public domain.
Disclaimer
This project is not affiliated with, endorsed by, or associated with OurAirports or its maintainers. It is an independent, third-party Django integration that consumes publicly available OurAirports data.
License
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
Metadata
Release files for django-ourairports 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django_ourairports-0.1.0.tar.gz | 28.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_ourairports-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 59.4 kB
Release files / django_ourairports-0.1.0.tar.gz
| Download URL | django_ourairports-0.1.0.tar.gz |
|---|---|
| Size | 28.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1dd0b6e14ad15a2bf68f8cf9b68b0c83cf86c6b946ea1737430a2e81a81b5b22
|
|
BLAKE2b-256 checksum How to use checksums |
88ca0c1b0b6d6fe4df0d1d22966066b731667af62df1f595e968d4e926b64f05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.
Transparency logRelease files / django_ourairports-0.1.0-py3-none-any.whl
| Download URL | django_ourairports-0.1.0-py3-none-any.whl |
|---|---|
| Size | 30.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
caa0a4d2cf3deb000dc78cfd06c976f18bdfedd5bf6ca09d5760064c0f734131
|
|
BLAKE2b-256 checksum How to use checksums |
db1905d1c8398c3a0c225aa0d948756b79567c3998cb1fc47d44e7c2c67c63fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 3, 2026.
Transparency log