3

I want to create a simple GeoDjango app with SpatiaLite database but I have this error at migrate:

django.core.exceptions.ImproperlyConfigured: Unable to load the SpatiaLite library extensio`.

Here the code :

settings.py

INSTALLED_APPS = [
    ..................
    'django.contrib.gis',
     .............
]

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.spatialite',
        'NAME': os.path.join(BASE_DIR, 'basetest.sqlite3'),
    }
}

Where I went wrong?

1

2 Answers 2

2

You need to install the SQLite spatial extension SpatiaLite:

  • on Debian-based GNU/Linux distributions (es: Debian, Ubuntu, …):

     $ apt install libsqlite3-mod-spatialite
    
  • on macOS using Hoembrew:

      $ brew install spatialite-tools
    

You can find complete example of a map with Geodjango and Spatialite in this article: Maps with Django (part 1): GeoDjango, SpatiaLite and Leaflet

0

In manjaro system/Arch, the install command is:

sudo pacman -Sy libspatialite

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.