问题
I'm following the GeoDjango Tutorial to set up a dev spatial DB for my project on my home machine, a Mac Mini running OSX 10.8.2. I installed the KyngChaos packages (UnixImageIO, PROJ, GEOS, SQLite3 and GDAL) and spatialite as detailed in the OSX section of the tutorial..
I created the database via spatialite, but when I try python manage.py sqlall world
to check the model I get the following error:
django.core.exceptions.ImproperlyConfigured: The pysqlite library does not support C extension loading. Both SQLite and pysqlite must be configured to allow the loading of extensions to use SpatiaLite.
There's not too much out there about this problem (and especially nothing for OSX) - most solutions involve installing pysqlite without the define=SQLITE_OMIT_LOAD_EXTENSION
option (e.g. here). I tried with both spatialite 2.3.1 and 2.4, I patched and installed pysqlite in my virtualenv but I always get the same problem.
Both spatialite
and sqlite3
binaries seem to execute properly, and setting up a non-spatial sqlite database for django works fine too, so I doubt it's an issue with SQLite itself.
Any hints on how to get this working would be great. Thanks.
来源:https://stackoverflow.com/questions/14330102/geodjango-and-spatialite-on-mac-issue-with-c-extension-loading