django-leaflet-geojson
django-leaflet-geojson copied to clipboard
Problems with Django 1.8
The example is a little hard to get running on Django 1.8 and Fedora 22 (and for me, a Django learner).
When trying to load all the weather stations I always get the error:
Traceback (most recent call last):
File "<console>", line 2, in <module>
File "/usr/lib/python2.7/site-packages/django/core/serializers/base.py", line 173, in save
models.Model.save_base(self.object, using=using, raw=True)
File "/usr/lib/python2.7/site-packages/django/db/models/base.py", line 735, in save_base
with transaction.atomic(using=using, savepoint=False):
File "/usr/lib/python2.7/site-packages/django/db/transaction.py", line 150, in __enter__
if not connection.get_autocommit():
File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 286, in get_autocommit
self.ensure_connection()
File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 130, in ensure_connection
self.connect()
File "/usr/lib/python2.7/site-packages/django/db/backends/base/base.py", line 119, in connect
self.connection = self.get_new_connection(conn_params)
File "/usr/lib/python2.7/site-packages/django/contrib/gis/db/backends/spatialite/base.py", line 66, in get_new_connection
six.reraise(ImproperlyConfigured, ImproperlyConfigured(new_msg), sys.exc_info()[2])
File "/usr/lib/python2.7/site-packages/django/contrib/gis/db/backends/spatialite/base.py", line 61, in get_new_connection
cur.execute("SELECT load_extension(%s)", (self.spatialite_lib,))
File "/usr/lib/python2.7/site-packages/django/db/backends/sqlite3/base.py", line 318, in execute
return Database.Cursor.execute(self, query, params)
ImproperlyConfigured: Unable to load the SpatiaLite library extension "libspatialite.so.7" because: /lib64/libspatialite.so.7: undefined symbol: sqlite3_spatialite_init
I have these packages installed:
- libspatialite 4.2
- libspatialite-devel 4,2
- spatialite-tools 4.2
- django-leaflet (pip)
- django-geojson (pip)
- gdal 1.11
- gdal-python 1.11
- gdal-devel 1.11
- proj-devel 4.8
- geos-devel 3.4
- pysqlite 2.6
- sqlite 3.9
Not sure if anything else is relevant. Don't really know how to debug this.
Thanks for posting some feedback here!
I haven't worked with this for almost a year, and it is very probable that this tutorial is outdated.
Unfortunately I can't help very much. You might find a better support on stackoverflow mentioning spatialite with (geo)django.
If you find a solution, please come back to contribute it here! Or at least post a comment for the next ones :)
Good luck !
Thanks. I will post here, when I figured out my mistake or what needs updating.
From documentation:
If you’re using SpatiaLite 4.2+, you must put this in your settings: SPATIALITE_LIBRARY_PATH = 'mod_spatialite'
It works for me.
I found that using mysql for a start is the easiest way. Sure postgis/spatiallite are more advanced for GIS stuff. but to setup a quick strat Mysql works out of the box for me.
The solution the @sikmir, too it works for me.
This is:
you’re using SpatiaLite 4.2+, you must put this in your settings: SPATIALITE_LIBRARY_PATH = 'mod_spatialite'