Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 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:

Description

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

See the traceback: http://dpaste.com/hold/170253/

Attachments (0)

Change History (8)

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

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

comment:2 Changed 4 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 4 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
django-admin.py startproject geodjangotest
cd geodjangotest
wget http://www.gaia-gis.it/spatialite/init_spatialite-2.3.sql.gz
gunzip init_spatialite-2.3.sql.gz
spatialite spatialite.db < init_spatialite-2.3.sql

Then setup your settings.py with the follow settings:

...

DATABASE_ENGINE = 'sqlite3'
DATABASE_NAME = 'spatialite.db'

...

INSTALLED_APPS = (
    ...
    'django.contrib.gis',
)

Try now run ./manage.py syncdb. Occurs this exception:

  ...
  File "/home/semente/.local/lib/python/site-packages/django/db/__init__.py", line 75, in <module>
    connection = connections[DEFAULT_DB_ALIAS]
  File "/home/semente/.local/lib/python/site-packages/django/db/utils.py", line 92, in __getitem__
    conn = backend.DatabaseWrapper(db, alias)
  File "/home/semente/.local/lib/python/site-packages/django/contrib/gis/db/backends/spatialite/base.py", line 33, in __init__
    self.ops = SpatiaLiteOperations(self)
  File "/home/semente/.local/lib/python/site-packages/django/contrib/gis/db/backends/spatialite/operations.py", 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 4 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 4 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 4 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 4 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 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.