You can face this error message when you're trying to make GIS Django application on OS X:
Unable to load the SpatiaLite library extension "/usr/local/lib/libspatialite.dylib"
If you install libspatialite 4.2.0 package by using Homebrew, then it installs libspatialite.dylib and mod_spatialite.dylib into its library path. When django.contrib.gis.db.backends.spatialite is used as a database backend, I'm not sure what happens on extension loading logic of sqlite3, it tries to find `sqlite3_spatialite_init` symbol from libspatialite.dylib. But that symbol dwells in mod_spatialite.dylib, so it fails. You can adjust this by adding SPATIALITE_LIBRARY_PATH to settings.py file:
SPATIALITE_LIBRARY_PATH='/usr/local/lib/mod_spatialite.dylib'
For sure, it can vary with the library path. Real path would be /usr/local/Cellar/libspatialite/x.x.x/lib/. (x.x.x is version number)
No comments:
Post a Comment