here is the exact error
django.db.migrations.loader.BadMigrationError: Migration 0001_initial in app django_comments has no Migration class
I have no idea what this means and I don't know where to go. I did some work with my venv, making a new one and then I was trying to get everything back to normal. Installing this and that...I lost track of everything I was doing because my laptop died which really pissed me off.
Any idea where to go from here?
EDIT:
If I try to upgrade django_comments I get the following error:
Could not find a version that satisfies the requirement django-comments (from versions: 0.2a, 0.3.1a, 0.3.2a, 0.3.3a, 0.3a, 1.0.0.b, 1.0.0.b, 1.0.0.b)
Cleaning up... No distributions matching the version for django-comments Storing debug log for failure in /home/jeff/.pip/pip.log
This may happen due to the following reasons: You did not add the app in INSTALLED_APPS list in settings.py (You have to add either the app name or the dotted path to the subclass of AppConfig in apps.py in the app folder, depending on the version of django you are using). Refer documentation: INSTALLED_APPS.
migrate , which is responsible for applying and unapplying migrations. makemigrations , which is responsible for creating new migrations based on the changes you have made to your models.
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.
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:
django_migrations
table and delete the row containing django_comments migrations and most probably the correspondent table, so you can apply the migration againYou 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 django-contrib-comments
:
pip install -U django-contrib-comments
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With