{"id":13468932,"url":"https://github.com/yourlabs/django-cities-light","last_synced_at":"2025-03-26T05:31:25.704Z","repository":{"id":2609034,"uuid":"3592516","full_name":"yourlabs/django-cities-light","owner":"yourlabs","description":"A simple app providing three models: Country, Region and City model. Also provided, a command to insert or update data from geonames database dumps. Status: stable.","archived":false,"fork":true,"pushed_at":"2025-02-26T15:48:16.000Z","size":18239,"stargazers_count":340,"open_issues_count":46,"forks_count":126,"subscribers_count":23,"default_branch":"master","last_synced_at":"2025-03-20T00:29:29.104Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://django-cities-light.rtfd.org/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"coderholic/django-cities","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yourlabs.png","metadata":{"files":{"readme":"README","changelog":"CHANGELOG","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-03-01T14:14:50.000Z","updated_at":"2025-03-18T18:51:50.000Z","dependencies_parsed_at":"2023-07-05T17:00:59.069Z","dependency_job_id":"6e87b00f-ebe4-4075-8b01-f015612d499d","html_url":"https://github.com/yourlabs/django-cities-light","commit_stats":{"total_commits":655,"total_committers":58,"mean_commits":"11.293103448275861","dds":0.3969465648854962,"last_synced_commit":"14d4996b24c49fc74d230f06c25dcf26e06efad1"},"previous_names":[],"tags_count":61,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-cities-light","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-cities-light/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-cities-light/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yourlabs%2Fdjango-cities-light/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yourlabs","download_url":"https://codeload.github.com/yourlabs/django-cities-light/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245597384,"owners_count":20641866,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T15:01:22.182Z","updated_at":"2025-03-26T05:31:25.692Z","avatar_url":"https://github.com/yourlabs.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":".. image:: https://secure.travis-ci.org/yourlabs/django-cities-light.svg?branch=master\n    :target: http://travis-ci.org/yourlabs/django-cities-light\n.. image:: https://img.shields.io/pypi/dm/django-cities-light.svg\n    :target: https://crate.io/packages/django-cities-light\n.. image:: https://img.shields.io/pypi/v/django-cities-light.svg\n    :target: https://crate.io/packages/django-cities-light\n.. image:: https://codecov.io/github/yourlabs/django-cities-light/coverage.svg\n    :target: https://codecov.io/github/yourlabs/django-cities-light\n\n\ndjango-cities-light -- *Simple django-cities alternative*\n=========================================================\n\nThis add-on provides models and commands to import country, subregion, region/state, and\ncity data in your database.\n\nThe data is pulled from `GeoNames\n\u003chttp://www.geonames.org/\u003e`_ and contains cities, subregions, regions/states and countries.\n\nSpatial query support is not required by this application.\n\nThis application is very simple and is useful if you want to make a simple\naddress book for example. If you intend to build a fully featured spatial\ndatabase, you should use\n`django-cities\n\u003chttps://github.com/coderholic/django-cities\u003e`_.\n\nRequirements:\n\n- Python \u003e= 3.8\n- Django \u003e= 3.2\n- MySQL or PostgreSQL or SQLite.\n\nYes, for some reason, code that used to work on MySQL (not without pain xD)\ndoes not work anymore. So we're now using django.db.transaction.atomic which\ncomes from Django 1.6 just to support MySQL quacks.\n\nFeatures\n--------\n- GraphQL support\n- Built-in admin support\n- Rest-Framework support\n- Ajax Select Lookup support\n\nUpgrade\n-------\n\nSee CHANGELOG.\n\nInstallation\n------------\n\nInstall django-cities-light::\n\n    pip install django-cities-light\n\nOr the development version::\n\n    pip install -e git+git@github.com:yourlabs/django-cities-light.git#egg=cities_light\n\nAdd `cities_light` to your `INSTALLED_APPS`.\n\nConfigure filters to exclude data you don't want, ie.::\n\n    CITIES_LIGHT_TRANSLATION_LANGUAGES = ['fr', 'en']\n    CITIES_LIGHT_INCLUDE_COUNTRIES = ['FR']\n    CITIES_LIGHT_INCLUDE_CITY_TYPES = ['PPL', 'PPLA', 'PPLA2', 'PPLA3', 'PPLA4', 'PPLC', 'PPLF', 'PPLG', 'PPLL', 'PPLR', 'PPLS', 'STLMT',]\n\nNow, run migrations, it will only create tables for models that are not\ndisabled::\n\n    ./manage.py migrate\n\nData import/update\n------------------\n\nFinally, populate your database with command::\n\n    ./manage.py cities_light\n\nThis command is well documented, consult the help with::\n\n    ./manage.py help cities_light\n\nBy default, update procedure attempts to update all fields, including Country/Region/Subregion/City slugs. But there is an option to keep them intact::\n\n    ./manage.py cities_light --keep-slugs\n\n\nGet more cities\n---------------\n\nThe configuration parameter CITIES_LIGHT_CITY_SOURCES, comes with the default value\nhttp://download.geonames.org/export/dump/cities15000.zip that has cities with a population\nover 15000, if you need to load cities with less population please use another source. For the list\nof available source please check here: http://download.geonames.org/export/dump/readme.txt\n\n\n\nUsing fixtures\n--------------\n\nGeonames.org is updated on daily basis and its full import is quite slow, so\nif you want to import the same data multiple times (for example on different\nservers) it is convenient to use fixtures with the helper management command::\n\n    ./manage.py cities_light_fixtures dump\n    ./manage.py cities_light_fixtures load\n\nTo reduce space, JSON fixtures are compressed with bzip2 and can be fetched\nfrom any HTTP server or local filesystem.\n\nConsult the help with::\n\n    ./manage.py help cities_light_fixtures\n\nDevelopment\n-----------\n\nCreate development virtualenv (you need to have tox installed in your base system)::\n\n    tox -e dev\n    source .tox/dev/bin/activate\n\nTo run the test project, with the folder of the project as the current directory, run::\n    \n    export PYTHONPATH=\"${PYTHONPATH}:/app/src\"\n    docker run  -d postgres -p 5432:5432\n\n\nThen run the full import::\n\n    test_project/manage.py migrate\n    test_project/manage.py cities_light\n\nThere are several environment variables which affect project settings (like DB_ENGINE and CI), you can find them all in test_project/settings.py.\n\nFor example to change the database engine, you can run::\n\n    export DB_ENGINE=postgresql\n    export DB_HOST=192.168.0.118\n    export DB_NAME=app\n    export DB_USER=postgres\n    export DB_PORT=5432\n\nTo run the test suite you need to have postgresql or mysql installed with passwordless login, or just use sqlite. Otherwise the tests which try to create/drop database will fail.\n\nRunning the full test suite::\n\n    tox\n\nTo run the tests in specific environment use the following command::\n\n    tox -e py312-django42-sqlite\n\nAnd to run one specific test use this one::\n\n    tox -e py312-django42-sqlite -- cities_light/tests/test_form.py::FormTestCase::testCountryFormNameAndContinentAlone\n\nTo run it even faster, you can switch to specific tox virtualenv::\n\n    source .tox/py312-django42-sqlite/bin/activate\n    CI=true test_project/manage.py test cities_light.tests.test_form.FormTestCase.testCountryFormNameAndContinentAlone\n\nIf you want to build the docs, use the following steps::\n\n    source .tox/dev/bin/activate\n    cd docs\n    make html\n\nTODOS\n-----\n\n- Add ruff for formatting\n- Improve the performance of the import command\n- Improve the local development environment with https://tox.wiki/en/legacy/example/devenv.html\n\nResources\n---------\n\nYou could subscribe to the mailing list ask questions or just be informed of\npackage updates.\n\n- `Git graciously hosted\n  \u003chttps://github.com/yourlabs/django-cities-light/\u003e`_ by `GitHub\n  \u003chttp://github.com\u003e`_,\n- `Documentation graciously hosted\n  \u003chttp://django-cities-light.rtfd.org\u003e`_ by `RTFD\n  \u003chttp://rtfd.org\u003e`_,\n- `Package graciously hosted\n  \u003chttp://pypi.python.org/pypi/django-cities-light/\u003e`_ by `PyPi\n  \u003chttp://pypi.python.org/pypi\u003e`_,\n- `Continuous integration graciously hosted\n  \u003chttp://travis-ci.org/yourlabs/django-cities-light\u003e`_ by `Travis-ci\n  \u003chttp://travis-ci.org\u003e`_\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourlabs%2Fdjango-cities-light","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyourlabs%2Fdjango-cities-light","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyourlabs%2Fdjango-cities-light/lists"}