Reputation: 455
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?
Upvotes: 6
Views: 5374
Reputation: 275
This problem can be created by following well meaning advice: if you tried python manage.py schemamigration south --initial
at any point in your debugging attempts, you'll create a 'migrations' folder in your site-packages in the South app itself. Unfortunately, the existence of a migrations
folder is how South determines if it should skip an app when performing its altered syncdb process. Including if that app... is South.
When you drop your database to try and debug from scratch, South's modified syncdb will skip creating the south_migrationhistory
table, assuming that the migrations folder will know better, and the migrations table requires the south_migrationhistory
table to work.
To solve the issue:
migrations/
folder in the south app. python ./manage.py syncdb
one last timeUninstalling/reinstalling South via pip won't actually cut it, as it'll leave the offending folder untouched.
Alternately, Marius Grigaitis proposed a workaround to the same error, although it was attributed at the time to a south bug.
Upvotes: 2
Reputation: 455
This all came about because south in my site_packages
had a migrations directory already, which i didn't know was there.When i got rid of the directory everything worked just fine.
Apologoies the stackoverflow folks that toiled to solve a problem that was caused due to my absent mindedness.
Upvotes: 4
Reputation: 29794
It seems that the migrations' tables are not being created in your database. It's a little bit odd by maybe this will work:
python manage.py schemamigration south --initial
python manage.py migrate south
and then continue with the other migrations.
Upvotes: 0
Reputation: 2452
If this is your first migration or you just want to start over:
rm -Rf your_app/migrations/
python manage.py syncdb --migrate
Next migrations would need:
python manage.py schemamigration your_app --auto
python manage.py migrate your_app
That works for me :)
Upvotes: 14
Reputation: 77912
You have to first migrate south itself to create south tables, then you can migrate your other applications:
# python manage.py migrate south
# python manage.py migrate
Upvotes: 1