Opened 6 years ago

Closed 6 years ago

Last modified 4 years ago

#13070 closed (fixed)

Wrong exception on django.contrib.gis from SVN

Reported by: Guilherme Gondim (semente) <semente@…> Owned by: nobody
Component: GIS Version: master
Severity: Keywords: geodjango
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:


Hi guys, I can't use the gis app with Django trunk. The same project works fine with Django 1.1.

See the traceback:

Change History (8)

comment:1 Changed 6 years ago by Guilherme Gondim (semente) <semente@…>

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 6 years ago by russellm

  • Resolution set to invalid
  • Status changed from new to closed

Closing invalid. I don't deny there's a problem, but a stack trace and the comment "can't use gis" doesn't help us reproduce it. Reopen if you care to provide *specific* details on how to reproduce the problem.

comment:3 Changed 6 years ago by Guilherme Gondim (semente) <semente@…>

  • Resolution invalid deleted
  • Status changed from closed to reopened

Sorry... follow more info.

How reproduce the bug:

cd /tmp startproject geodjangotest
cd geodjangotest
gunzip init_spatialite-2.3.sql.gz
spatialite spatialite.db < init_spatialite-2.3.sql

Then setup your with the follow settings:


DATABASE_NAME = 'spatialite.db'



Try now run ./ syncdb. Occurs this exception:

  File "/home/semente/.local/lib/python/site-packages/django/db/", line 75, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/home/semente/.local/lib/python/site-packages/django/db/", line 92, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
  File "/home/semente/.local/lib/python/site-packages/django/contrib/gis/db/backends/spatialite/", line 33, in __init__
    self.ops = SpatiaLiteOperations(self)
  File "/home/semente/.local/lib/python/site-packages/django/contrib/gis/db/backends/spatialite/", line 128, in __init__
    (self.connection.settings_dict['NAME'], msg))
django.core.exceptions.ImproperlyConfigured: Cannot determine the SpatiaLite version for the "sqlite3.db" database (error was "no such function: spatialite_version").  Was the SpatiaLite initialization SQL loaded on this database?

The same procedure works with Django 1.1.

Software versions:

SpatiaLite version ..: 2.3.0    Supported Extensions:
        - 'VirtualShape'        [direct Shapefile access]
        - 'VirtualText'         [direct CSV/TXT access]
        - 'VirtualNetwork       [Dijkstra shortest path]
        - 'RTree'               [Spatial Index - R*Tree]
        - 'MbrCache'            [Spatial Index - MBR cache]
        - 'VirtualFDO'          [FDO-OGR interoperability]
        - 'SpatiaLite'          [Spatial SQL - OGC]
PROJ.4 Rel. 4.6.1, 21 August 2008
GEOS version 3.1.0-CAPI-1.5.0

...and pysqlite 2.5.6 with load extension support and sqlite3 3.6.16. Ubuntu 9.10 Karmic.

comment:4 Changed 6 years ago by russellm

  • Triage Stage changed from Unreviewed to Accepted

If this is a regression, it needs to be addressed for 1.2

comment:5 Changed 6 years ago by steveed

I was unable to reproduce this error:

I am using:
Xubuntu 9.10
Django version 1.2 beta 1 SVN-12855
sqlite 3.6.16
spatialite 2.3.0

comment:6 Changed 6 years ago by Guilherme Gondim (semente) <semente@…>

Well, on Ubuntu 10.04 Lucid I have the same problem. What is your pysqlite version?

comment:7 Changed 6 years ago by jbronn

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [12882]) Fixed #13070 -- Introduced fallback code to detect SpatiaLite 2.3.0 versions (which do not have spatialite_version function).

comment:8 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top