2

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
0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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