Skip to main content

A Django app to provide a database structure, API and import scripts to manage French communes, intercommunalités, départements and régions, with their structure and data from Insee and the DGCL.

Project description

https://badge.fury.io/py/django-francedata.svg https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/django.yml/badge.svg https://github.com/entrepreneur-interet-general/django-francedata/actions/workflows/codeql-analysis.yml/badge.svg

Django-Francedata

Provides a database structure, API and import scripts to manage French communes, intercommunalités, départements and régions, with their structure and data from Insee and the DGCL.

This app was created as a part of Open Collectivités.

Unaccent extension

If the PostgreSQL user specified in the Django settings is not a superuser, connect to the postgres user and create the Unaccent extension manually:

psql
\c <dbname>
"CREATE EXTENSION  IF NOT EXISTS unaccent;"

Quickstart

  1. Add “francedata” to your INSTALLED_APPS setting like this:

    INSTALLED_APPS = [
        ...
        "django_json_widget",
        "simple_history",
        "francedata",
    ]
  2. Run python manage.py migrate to create the francedata models.

  3. Run the two initialization commands to get the communes, EPCIs, départements and régions structure:

    python manage.py cog_import
    python manage.py banatic_import
  4. Visit http://127.0.0.1:8000/admin/ to see the data.

Commands

cog_import:

  • goal: load the following data from the Code officiel géographique (COG): list of regions, departements and communes, with how they are linked and: * insee and siren ids for the regions/departements * insee for the communes

  • parameters: * –level: partial import of only the specified level (the script expects the higher ones to already be installed) Allowed values: regions, departements, communes * –years: import the specified year (min: 2019), by default it imports the latest available one in https://www.data.gouv.fr/fr/datasets/code-officiel-geographique-cog/

banatic_import:

Project details


Download files

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

Source Distribution

django-francedata-0.15.0.tar.gz (65.4 kB view details)

Uploaded Source

Built Distribution

django_francedata-0.15.0-py3-none-any.whl (88.7 kB view details)

Uploaded Python 3

File details

Details for the file django-francedata-0.15.0.tar.gz.

File metadata

  • Download URL: django-francedata-0.15.0.tar.gz
  • Upload date:
  • Size: 65.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.12 Linux/5.13.0-1021-azure

File hashes

Hashes for django-francedata-0.15.0.tar.gz
Algorithm Hash digest
SHA256 ec39a70252a6d38dcf0f6f4b440866ca192fac16418960cb0b3fcf84c1505577
MD5 ccf9d7463ebf9d0f884f7d08598b1ce4
BLAKE2b-256 32e9808e3fb1d01b462bf3dd1737c36219f5d2072e113087e670e95302f8042a

See more details on using hashes here.

File details

Details for the file django_francedata-0.15.0-py3-none-any.whl.

File metadata

  • Download URL: django_francedata-0.15.0-py3-none-any.whl
  • Upload date:
  • Size: 88.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.9.12 Linux/5.13.0-1021-azure

File hashes

Hashes for django_francedata-0.15.0-py3-none-any.whl
Algorithm Hash digest
SHA256 156adc01d33ca5575749de07aea4a45147ec1b9ab72e87c2b1bfc33e22c063f8
MD5 3fad57febc3fdc17376537fa9c162d48
BLAKE2b-256 98576a1649a807bc29a20bf2c1133be787a58a084b6aeb508e86ee1ab59e5185

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page