26π
I solved the problem.
Obviously, you canβt use South to do the migrations for the apps that are part of Django, like βauthβ so I didnβt know why it was trying to.
I realised that for a while I had another app within my project called auth. I must have tried to migrate this at some point before renaming it and therefore messed it all up.
I removed the migration history entries from the database for that app and everything was fine.
43π
Leaving this here for future googlers
I recently ran into this exceptions with one of my own apps today, not a contrib one.
After a bit of head-scratching I noticed that somehow the file β¦
app/migrations/__init__.py
β¦ had been deleted, which means python cant import the dir as a module etc etc.
- [Django]-Loop backwards using django template
- [Django]-How to encode UTF8 filename for HTTP headers? (Python, Django)
- [Django]-Add class to Django label_tag() output
11π
I just ran into this after swithcing branches and app versions, and decided to remove the app that now had no migrations from the south_migrationhistory table
./manage.py dbshell
mysql> SELECT * FROM south_migrationhistory WHERE app_name = 'social_auth';
104 | social_auth | 0001_initial...
105 | social_auth | 0002_auto__add_unique_nonce...
mysql> DELETE FROM south_migrationhistory WHERE app_name = 'social_auth';
Query OK, 2 rows affected (0.00 sec)
- [Django]-Proper way to handle multiple forms on one page in Django
- [Django]-Django prefetch_related id only
- [Django]-Celery. Decrease number of processes
5π
I also had the same problem, and at the end I fixed this by deleting all rows from south_migrationhistory table and run the following command from terminal.
python manage.py reset south
This answer explain about how to reset south migration history.
Edit:
From Django 1.5 onwards reset
command wonβt work. Instead you have to use flush
.
python manage.py flush
To understand more about what flush will do read this stackoverflow answer.
- [Django]-Adding custom fields to users in Django
- [Django]-Django Rest Framework with ChoiceField
- [Django]-How to use csrf_token in Django RESTful API and React?
1π
I also had the same issue, however this happened to the root application. I discovered that this was due to an empty models.py
in my project root from earlier development. I suspect this issue may arise for project applications also.
- [Django]-Remove duplicates in Django ORM β multiple rows
- [Django]-Replacing a character in Django template
- [Django]-How to customize user profile when using django-allauth
1π
You can do migrations on built-in modules, and it definitely makes sense for data migrations, for example, truncating all usernames, removing invalid emails, et cetera.
In the case of a User from django.contrib.auth.models, simply use: orm[βauth.Userβ]
- [Django]-How do I migrate a model out of one django app and into a new one?
- [Django]-How to pass a message from HttpResponseRedirect in Django?
- [Django]-Django β Can you use property as the field in an aggregation function?
0π
I got the same error, but not for a django module, but for a module that was part of my virtualenv. I didnβt get how south could have done a migration for that module, since it really didnβt have any migrations. Then I remembered I had copied the database from an test env that was supposed to be the same. But it turned out the other env had a slightly different version of the module which did have a migration.
I ended up deleting the offending row from the south migrationhistory (since it was a test env anyway).
- [Django]-Memory efficient (constant) and speed optimized iteration over a large table in Django
- [Django]-Add an object by id in a ManyToMany relation in Django
- [Django]-Django REST Framework: Unique_together validation on Serializers
0π
I had a similar problem with django.contrib.admin not letting me run my migrations. I solved it by disabling django.contrib.admin in settings.INSTALLED_APPS
- [Django]-Django template display item value or empty string
- [Django]-How do I override delete() on a model and have it still work with related deletes
- [Django]-How to clear / maintain a django-sentry database?