17

I have been working on an application using django and mysql, am trying now to work on the tutorial from this here

http://docs.djangoproject.com/en/1.2/ref/contrib/gis/tutorial/

but it failed the moment I ran syncdb with the following error

AttributeError: 'DatabaseOperations' object has no attribute 'geo_db_type'

When I read around, it says that this can be solved if changed the backend to use postGIS. Is there a way to continue using mysql as my backend and yet be able to use geodjango? if not, is it possible to use both in the same project?

Regards,

Mo J. Mughrabi
  • 6,747
  • 16
  • 85
  • 143
  • The [GeoDjango installation docs](https://docs.djangoproject.com/en/2.1/ref/contrib/gis/install/#ref-gis-install) go into detail about what libraries are needed to use the various db backends. – Daniel Roseman Jan 02 '11 at 12:36

2 Answers2

36

set django.contrib.gis.db.backends.mysql in your settings.DATABASE engine db config.

panchicore
  • 11,451
  • 12
  • 74
  • 100
5

Does your MySQL have spatial data types installed? What do you get if you do:

CREATE TABLE geom (g GEOMETRY);

If that doesn't recognise the GEOMETRY type, then you need to upgrade/recompile/reconfigure your MySQL.

Spacedman
  • 92,590
  • 12
  • 140
  • 224