I wanted to create a south migration for one of my django apps. An app with geospatial field types. Oops:
$> bin/django schemamigration lizard_opendap --initial
! Cannot freeze field 'lizard_opendap.point.geom'
! (this field has class django.contrib.gis.db.models.fields.PointField)
! Cannot freeze field 'lizard_opendap.line.geom'
! (this field has class django.contrib.gis.db.models.fields.LineStringField)
! South cannot introspect some fields; this is probably because they are custom
! fields. If they worked in 0.6 or below, this is because we have removed the
! models parser (it often broke things).
! To fix this, read http://south.aeracode.org/wiki/MyFieldsDontWork
Weird. I googled a bit and found out that support for those geom fields was added some years ago. So it should work.
The solution: I forgot to add 'django.contrib.gis'
to
INSTALLED_APPS
in settings.py
. I thought that entry wasn’t needed
anymore, so I tend to leave it out. (Iirc, it used to be necessary because of
geospatial databases, but those databases work just fine without adding
django.contrib.gis to INSTALLED_APPS now).
Yep, now it works:
$> bin/django schemamigration lizard_opendap --initial
+ Added model lizard_opendap.Setting
+ Added model lizard_opendap.SourceModel
+ Added model lizard_opendap.Scenario
+ Added model lizard_opendap.ModelResult
+ Added model lizard_opendap.Point
+ Added model lizard_opendap.PointValue
+ Added model lizard_opendap.Line
+ Added model lizard_opendap.LineValue
Created 0001_initial.py. You can now apply this migration with: ./manage.py migrate lizard_opendap
My name is Reinout van Rees and I program in Python, I live in the Netherlands, I cycle recumbent bikes and I have a model railway.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):