When trying to complete the GeoDjango tutorial, I’m running into issues that prevent me from continuing.
Issues first arise when trying the LayerMapping section. When running world.load()
, I received an error django.db.utils.IntegrityError: NOT NULL constraint failed: world_worldborder.fips
.
I tried setting strict=False
in the world.load()
code, and that allowed me to continue, though with several more reported errors, filling my terminal with An error occurred in the current transaction. You can't execute queries until the end of the 'atomic' block. Continuing
.
In that case it brings me back to the console, where I was hopeful that there’d be some items that loaded/saved successfully. However, in the Spatial Lookups section when performing the WorldBorder.objects.filter
steps, my QuerySets all end up empty, and when performing the WorldBorder.objects.get
steps, I get the error WorldBorder matching query does not exist
. Finally, when viewing WorldBorders in the admin panel, it reports “0 world borders”.
FWIW, I had a similar thought process as the user who created this issue, and tried some of the same things that they did, like using the model created by ogrinspect
and modifying code to say geom
instead of mpoly
, without success. On the issue thread, a developer responded that they could run everything just fine, and then closed the issue.
The last thing I can think of is that maybe the data in the shapefile have changed. If that’s the case, then maybe getting ahold of an older copy may help complete this tutorial. It’d be weird though if thematicmapping.org would change the shapefile without updating the version in the process.
Any help or feedback is appreciated.