42👍
It’s a pretty late response but for people who will run into the same issue (like I did).
Normally to drop the db_tables for the app that is managed by south you should use:
python manage.py migrate appname zero
But if you dropped them manually in the db let south know about it
python manage.py migrate appname zero --fake
And of course to recreate the tables
python manage.py migrate appname
27👍
Had the identical problem. Not sure this works in all circumstances, but here’s what I did:
- comment out “south” from INSTALLED_APPS
- run manage.py syncdb
- uncomment “south” in INSTALLED_APPS
- run manage.py migrate
Voila!
Your mileage may vary….
- [Django]-What is the meaning of bind = True keyword in celery?
- [Django]-Asynchronous File Upload to Amazon S3 with Django
- [Django]-TypeError: data.forEach is not a function
2👍
Hmm this exchange covers my very question:
If you modify the database by hand, South won’t notice – its only way of
keeping track of what version the database is is the
south_migrationhistory table, so if you fiddle behind its back, it’s
your responsibility to fix it.
What I ended up doing was commenting out the model that I dropped in question, doing a schemamigration
, creating an empty no-column table of the one I dropped (so South has something to drop), migrate
ing, then un-commenting the model, schemamigration
and migrate
ing again. A bit more annoying than just dropping the table and syncdb
but ah well.
- [Django]-Django: how to set log level to INFO or DEBUG
- [Django]-Django: field's default value from self model's instances
- [Django]-What does request.user refer to in Django?
1👍
Make sure all your migrations are applied:
python manage.py migrate
Tell Django to create the tables as they are in your models: python manage.py syncdb
Tell South that everything is where it should be: python manage.py migrate appname --fake
This assumes that nothing has changed in any of your models since you created your last migration.
- [Django]-What is the format in which Django passwords are stored in the database?
- [Django]-How to get an app name using python in django
- [Django]-How to convert JSON data into a Python object?
0👍
I know this issue is old, but I just ran into this issue and thought I’d post my solution in case this helps anyone.
- Go into your
models.py
folder where the database is. - Cut the entire class out of the
models.py
file. - Run ./manage.py schemamigration
appname
–auto (this will create another migration whereSouth
will recognize to delete this table). You may need to recreate a blank table in you database soSouth
sees it. - Run the
migration
and the table should drop from your database. - Re-paste in your table class back to where it was in your
models.py
file. - Run a ./manage.py schemamigration
appname
–auto. South should pick up the table and allow you to migrate - Run ./manage.py migrate
appname
and South should re-add the table back into your databasse… with the columns and such again, but without the data, obviously. 🙂
- [Django]-Django: Catching Integrity Error and showing a customized message using template
- [Django]-RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS
- [Django]-How do I use Django's form framework for select options?