Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

TERYT database implementation for Django

Project Description

django-teryt is a Django app that implements TERYT database. TERYT (Polish: “Krajowy Rejestr Urzędowy Podziału Terytorialnego Kraju”, English: “National Official Register of Territorial Division of the Country”) is a register maintained by Polish Central Statistical Office (Polish: Główny Urząd Statystyczny; GUS). Among other things it contains:

  • identifiers and names of units of territorial division,
  • identifiers and names of localities,
  • identifiers and names of streets

This app parses XML files from GUS and it imports them to the database. It is meant to be used as a part of a larger system.


The full documentation is at


Install django-teryt:

pip install django-teryt

If you are using Django 1.6 or lower you have to install South:

pip install 'south>=1.0'

Add teryt to INSTALLED_APPS in your and run:

./ migrate teryt

Then download TERYT data from GUS website, unpack it and then import it:

./ teryt_parse /path/to/WMRODZ.xml /path/to/TERC.xml /path/to/SIMC.xml /path/to/ULIC.xml


  • It can import all data from all TERYT files
  • It deals with updates (just run ./ teryt_parse –update TERC.xml)
  • It keeps flag (aktywny) telling you if some record is still present in TERYT (there are some minor changes in territorial division from time to time)


All bug reports and pull requests are welcome. You can report them at It can be in English or in Polish ;)


0.1.0 (2013-12-31)

  • First release on PyPI.

0.2.0 (2015-01-08)

  • Added support for Django 1.7 migrations
  • Moved common data to abstract base class
  • Added common flag filed (aktywny)
  • Added 3 model managers to JednostkaAdministracyjna
  • Fixed PEP 8 compliance in main source files

0.3.0 (2015-01-06)

  • Added support for Django 1.8 and 1.9
  • Added support for SQLite and MySQL/MariaDB
  • Python 3.4 compatibility
  • Improved test coverage
  • This is last version to support Django 1.6 and South
Release History

Release History

This version
History Node


History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_teryt-0.3.0-py2.py3-none-any.whl (24.4 kB) Copy SHA256 Checksum SHA256 2.7 Wheel Jan 6, 2016
django-teryt-0.3.0.tar.gz (15.3 kB) Copy SHA256 Checksum SHA256 Source Jan 6, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting