Note to self: Django/South basic usage

Not that I understand how this schema migration thing actually works. Anyway, initially, on an empty database:
./manage.py syncdb --noinput
./manage.py schemamigration YOUR_APP --initial
./manage.py migrate YOUR_APP 0001 --fake
Then, after fiddling with your models:
./manage.py schemamigration YOUR_APP --auto
./manage.py migrate YOUR_APP
That should do it. But like I said, my understanding of the system is very limited and I'm sure there are cases when this simplistic pattern just won't cut it. My needs, however, at the moment are not the most complicated.

Tagged with:

Categorised as:


Note to self: Django's Error: cannot import name Foo

If Foo is definitely defined, then this is most likely a circular import which can be avoided by dropping the "redundant" import statement and referring not directly to the Model itself, but its' name. This is known as a lazy relationship:
foo = models.ForeignKey('Foo')

Tagged with:

Categorised as: