0

I'm trying to do the GeoDjango Tutorial using Sqlite as described here.

When I call the load.py script it stops showing the error:

Failed to save the feature (id: 206) into the model with the keyword arguments:
{'fips': 'UK', 'iso2': 'GB', 'iso3': 'GBR', 'un': 826, 'name': 'United Kingdom'
...
sqlite3.IntegrityError: NOT NULL constraint failed: world_worldborder.mpoly
...
django.db.utils.IntegrityError: NOT NULL constraint failed: world_worldborder.mpoly

Has anyone know this problem's cause? And a way to Django manage the geometry well importing all the data including 'United Kingdom' record?

I'm using:

  • Ubuntu 18.04
  • Python 3.6.8
  • Django==2.2.7
  • pkg-resources==0.0.0
  • pytz==2019.3
  • spatialite==0.0.3
  • sqlparse==0.3.0
  • libgeos-dev==3.6.2-1build2
  • binutils==2.30-21ubuntu1~18.04.2
  • libproj-dev==4.9.3-2
  • gdal-bin==2.2.3+dfsg-2
  • libgdal-dev==2.2.3+dfsg-2
  • python3-gdal==2.2.3+dfsg-2

1 Answers1

0

I only could handle it setting the mpoly/geom field null=True in the models.py:

mpoly = models.MultiPolygonField(null=True)

It is not a complete solution because at least 'United Kingdom' was ignored. But it was a very good workaround.

I don't think there is a problem in the TM_WORLD_BORDERS-0.3.shp. It seems there is a problem when Django try to generate the SQL.