westwood
westwood

Reputation: 1774

Django: skip system check when running custom command

I've added a custom management command to an application developed using Django 1.6.11. This command, let's call it initdb, performs a set of particualr actions:

In other words, it's very handy for quick database initialization from total zero.

Now, I'm migrating to Django 1.8.5 and one thing I've noticed is that, before almost every command, Django automatically executes check command from new system check framework, which among other stuff checks if database/user form settings.py exist. That leads to a situation when I can't run my custom command because automatic check throws exceptions that there is no access to database (indeed, my custom command should create it).

Is there any way to force skipping automatic check that Django makes, at least in custom management command?

Upvotes: 5

Views: 3146

Answers (1)

Daniel Roseman
Daniel Roseman

Reputation: 599866

Yes, and this is fully documented; set the requires_system_checks attribute to False in your Command subclass.

Upvotes: 10

Related Questions