Buildout is an awesome build management tool for Python projects, managing dependencies and featuring rich recipes for accomplishing advanced tasks. The main problem seems to be that documentation is lacking and/or terrible. Plus, project setup is painstaking and difficult to get right. Since I have years of experience in Maven, where creating a buildable project takes (literally) seconds to accomplish, this initially made Buildout too much of a hurdle. However, that’s now changed, as I’ve recently released version 0.1.0 of buildout-starter, an installable Python script to make creating Python and Django projects with Buildout a snap.
I’ve just written a new Django app called django-locality. It’s a pretty simple Django application which includes a few key features:
- Country objects stored in the database.
- Territory objects stored in the database.
- Each country has 0 or more territories.
- View functions to get territories by country, all territories, all countries, or a country.
- Territories have abbreviations and names.
- Countries have ISO 3166-1 Alpha 2 Names (2 digit unique abbreviations), ISO 3166-1 Alpha 3 names (3 digit unique abbreviations), and each uses its country code number as its id.
This opens up a lot of possibilities. Simply add
'locality' to your
INSTALLED_APPS in your
settings.py file, run
syncdb to install the models and the initial data, and off you go. You can tie your own custom classes to countries and territories like any other Django object.
It’s really simple, but it’s really refreshing to finally be able to do things in a way that makes sense. The module is available on PyPI, so you can integrate it into your build process with `setuptools`.