Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#12727 closed (invalid)

Error while doing syncdb with a GIS app

Reported by: asgrewal Owned by: nobody
Component: GIS Version: 1.2-alpha
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The following error occurs while doing syncdb when an app contains GIS information, in my case a simple model with a PointField member. I am using Postgresql with postgis. The same code works fine for django 1.1

(django-dev-sandbox)ajeet@virtual-ubuntu:~/projects/enroute2$ python manage.py syncdb
Traceback (most recent call last):
  File "manage.py", line 11, in <module>
    execute_manager(settings)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/core/management/__init__.py", line 438, in execute_manager
    utility.execute()
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/core/management/__init__.py", line 379, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/core/management/base.py", line 195, in run_from_argv
    self.execute(*args, **options.__dict__)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/core/management/base.py", line 222, in execute
    output = self.handle(*args, **options)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/core/management/base.py", line 351, in handle
    return self.handle_noargs(**options)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/core/management/commands/syncdb.py", line 78, in handle_noargs
    sql, references = connection.creation.sql_create_model(model, self.style, seen_models)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/db/backends/creation.py", line 50, in sql_create_model
    col_type = f.db_type(connection=self.connection)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/db/models/fields/subclassing.py", line 28, in inner
    return func(*args, **kwargs)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/db/models/fields/subclassing.py", line 28, in inner
    return func(*args, **kwargs)
  File "/home/ajeet/django-dev-sandbox/lib/python2.6/site-packages/django/contrib/gis/db/models/fields.py", line 200, in db_type
    return connection.ops.geo_db_type(self)
AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'

Change History (2)

comment:1 by jbronn, 15 years ago

Resolution: invalid
Status: newclosed

Due to the multi-db merge into trunk, in order to be backwards-compatible with 1.1.X settings, you'll need 'django.contrib.gis' in your INSTALLED_APPS setting to ensure that the spatial database backend (django.contrib.gis.db.backends.postgis) is used instead of the regular backend (django.db.backends.postgresql_psycopg2). You can also just upgrade your settings to use the new DATABASES syntax for configuring your database and explicitly specify the spatial backend:

DATABASES = {
    'default': {
        'ENGINE': 'django.contrib.gis.db.backends.postgis',
        'NAME': 'geodjango',
        'USER': 'myuser',
    }
}

comment:2 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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