7

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?

Cagatay Barin
  • 3,428
  • 2
  • 24
  • 43
Kevin Gill
  • 407
  • 1
  • 5
  • 14
  • Disabling the system checks is the wrong solution. You need to make sure that you don't execute any queries when importing modules. This is just one of the issues this can cause. – knbk Mar 04 '16 at 11:52
  • @knbk And what about model checks? – DylanYoung Aug 17 '20 at 19:15

1 Answers1

3

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.

Davit Tovmasyan
  • 3,238
  • 2
  • 20
  • 36