leplatrem / django-leaflet-geojson

58 stars 25 forks source link

Problems with Django 1.8 #7

Open tobias47n9e opened 8 years ago

tobias47n9e commented 8 years ago

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:

Not sure if anything else is relevant. Don't really know how to debug this.

leplatrem commented 8 years ago

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 !

tobias47n9e commented 8 years ago

Thanks. I will post here, when I figured out my mistake or what needs updating.

sikmir commented 8 years ago

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.

vectorien commented 8 years ago

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.

dfrestrepor commented 6 years ago

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'

Django Documentation