As the problem is related to the migration, you have to understand first how it works, django check you database schema compares it with your model then generates the migration script. Every migration script is executed one time, because django keep tracking you migrations. This is managed by a table called
django_migrations that is created in your database the first time migrations are ran. So I will suggest two things:
- if you have no data in your db, or no important data so I suggest to drop it and create new one then apply all the migrations again
- if you have important data, try to look in the
django_migrationstable and delete the row containing django_comments migrations and most probably the correspondent table, so you can apply the migration again
I had this problem, and it turned out that I had accidentally copied a non-migration file into one of my migrations folders. Removing the errant file fixed this for me.
You are probably using an old version of
django-contrib-comments that only supports Django 1.6. It will have South migrations in the
migrations/ folder, instead of the new Django migrations.
To fix this, simply upgrade
pip install -U django-contrib-comments
- Django difference between clear() and delete()
- Why does Django use tuples for settings and not lists?
For me the migration file in question was empty. Deleting it solved my problem
- Can we have Django DateTimeField without timezone?
- Authentication app for Django
- Django admin enable sorting for calculated fields
- Django @csrf_exempt not working in class View
- Sphinx-apidoc on django build html failure on `django.core.exceptions.AppRegistryNotReady`
I had a file in the migration folder that didn’t belong there. By deleting the misplaced file, I fixed the issue.
- Django Testing – Hard code URLs or Not
- Why is Django's Meta an old-style class?
- Why isn't psycopg2 executing any of my SQL functions? (IndexError: tuple index out of range)
- find the root directory of python in C: drive then delete python and also delete pip.
- after deleting these both items download the new python and install it again.
I’ve shared my Django ORM DB model between my custom APP and a Django App via symbolic links:
- Django: test failing on a view with @login_required
- Django queryset: Exclude list of emails using endswith
- Removing the Label From Django's TextArea Widget
- Django command: How to insert newline in the help text?
- Why django uses a comma as decimal separator
For me I accidentally put other file(views.py) in migrations directory that cause this error.
Migration X in app X has no Migration class
This mean migrations loader search for class Migration in each py file in migrations directory in case of if migrations class not found then it’ll raise this error
- Stop nosetests from printing logging information?
- ForeignKey to a model that is defined after/below the current model
- Django queryset order_by dates near today
- How do you get Django to make a RESTful call?