Skip to main content
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:

Metadata

Release files for django-francedata 0.16.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-francedata 0.16.2
File Size Uploaded
django_francedata-0.16.2.tar.gz 65.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-francedata 0.16.2
File Interpreter ABI Platform
django_francedata-0.16.2-py3-none-any.whl Python 3 none any Details

Total release size: 155.5 kB

Release files / django_francedata-0.16.2.tar.gz

Download URL django_francedata-0.16.2.tar.gz
Size 65.9 kB
Tags Source
SHA-256 checksum
How to use checksums
56e1c3c0ad492631ad6b3e9fe487ec99cc81fe065b20c1d96b82bfbaf331d970
BLAKE2b-256 checksum
How to use checksums
fc8ea12f2762be8578d62adae22af9159feaf3efc3acf29038043f429e8c2ce0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1024-azure

Release files / django_francedata-0.16.2-py3-none-any.whl

Download URL django_francedata-0.16.2-py3-none-any.whl
Size 89.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9584745544679a94fbc60e120f770fef1dc5522e1cfaf779e9da5e5c6298115f
BLAKE2b-256 checksum
How to use checksums
3ba15b11971a51978b53dae3e4c3e693492ff482d73091fa2af4df2524f45ab1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.3.2 CPython/3.9.16 Linux/5.15.0-1024-azure

Release history Release notifications | RSS feed

This release

0.16.2 This release

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.15.0

2 release files

0.14.5

2 release files

0.14.4

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.9.3

2 release files

0.9.2

2 release files

0.9.1

2 release files

0.9.0

2 release files

0.8.5

1 release file

0.8.4

1 release file

0.8.3

1 release file

0.8.2

1 release file

0.8.1

1 release file

0.8

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page