I upgraded from Django 1.7 to Django 1.9. I have a number of migrations. Since the upgrade I can no longer create a fresh database.
The problem is that "django manage.py migrate" runs checks. The checks import the application urls. These ultimately import code that looks up the database.
I can get the migration to work, by modifying the migrate.py script and adding this line (as per Django: skip system check when running custom command):
requires_system_checks = False
Is there a standard/supported way to prevent the system checks via a command line parameter, or is there a way to know that I am running in a management command during the url loading so that I can exclude the web-serving parts of the system?
you can either: temporarily remove your migration, execute python manage.py migrate, add again your migration and re-execute python manage.py migrate. Use this case if the migrations refer to different models and you want different migration files for each one of them.
You can selectively disable migration for one or more Django-Models by setting managed = False in Django Model Meta options. Save this answer.
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.
You don't have migrations folder inside those apps. (Solution: just create that folder). You don't have __init__.py file inside migrations folder of those apps. (Solution: Just create an empty file with name __init__.py )
There is a way in the 3.0 version, there is a flag called --skip-checks which skips running system checks prior to running the command.
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