How to i get the south migrations to work

djangodjango-southmigration

I am having trouble having south to work with my django project, i have followed the south documentation on converting apps to south and also looked here (Why don't my south migrations work?) but all in vain.

After adding south to INSTALLED_APPS and run syncdb,

Synced:
 > django.contrib.messages
 > django.contrib.staticfiles
 > smartmin
 > nsms.console
 > django_extensions
 > pagination
 > restaurant_detail
 > live
 > debug_toolbar
 > orders
 > django.contrib.admindocs

Not synced (use migrations):
 - django.contrib.auth
 - django.contrib.contenttypes
 - django.contrib.sessions
 - django.contrib.sites
 - guardian
 - south
 - django_quickblocks
 - rapidsms
 - rapidsms_httprouter
 - sorl.thumbnail
 - djangoratings
 - agon_ratings
 - django.contrib.admin
(use ./manage.py migrate to migrate these)

at this point i execute this command,python manage.py migrate, this gives error django.db.utils.DatabaseError: relation "south_migrationhistory" does not exist
LINE 1: ...gration", "south_migrationhistory"."applied" FROM "south_mig...

What am i doing wrong here?

Best Answer

If this is your first migration or you just want to start over:

  1. Drop and create your current database
  2. Remove your migrations directory: rm -Rf your_app/migrations/
  3. Sync and migrate in just one command: python manage.py syncdb --migrate

Next migrations would need:

  1. python manage.py schemamigration your_app --auto
  2. python manage.py migrate your_app

That works for me :)

Related Topic