问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/35792376/django-migration-disabel-system-checks