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
Add “francedata” to your INSTALLED_APPS setting like this:
INSTALLED_APPS = [ ... "django_json_widget", "simple_history", "francedata", ]Run python manage.py migrate to create the francedata models.
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
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:
goal: load the following data from the Banatic: * siren ids and population data for the communes * insee for the communes
The script expects that cog_import was already run and that the communes level is passed before the epci level.
parameters: * –level: partial import of only the specified level. Allowed values: communes, epci * –years: import the specified year (min: 2019 for the communes level (data is taken from the file Table de correspondance code SIREN / Code Insee des communes from https://www.banatic.interieur.gouv.fr/V5/fichiers-en-telechargement/fichiers-telech.php ), by default it imports the latest available one)
warning: The epci level only works for the current year (data is taken from https://www.data.gouv.fr/fr/datasets/base-nationale-sur-les-intercommunalites/ )
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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_francedata-0.16.2.tar.gz | 65.9 kB | Without provenance | Details for django_francedata-0.16.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_francedata-0.16.2-py3-none-any.whl | Python 3 | none | any | Details for django_francedata-0.16.2-py3-none-any.whl |
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
|
Security for django-francedata 0.16.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.