Code

Opened 4 years ago

Closed 4 years ago

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

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'

Attachments (0)

Change History (2)

comment:1 Changed 4 years ago by jbronn

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

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 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.