#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'
Note:
See TracTickets
for help on using tickets.
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 yourINSTALLED_APPSsetting 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 newDATABASESsyntax for configuring your database and explicitly specify the spatial backend: