You can always just check the django source code. This, you know, is open source.
For collectstatic:
message.append( 'Are you sure you want to do this?\n\n' "Type 'yes' to continue, or 'no' to cancel: " ) if self.interactive and input(''.join(message)) != 'yes': raise CommandError("Collecting static files cancelled.")
So, to collect static, if you set --no-input
, it will set interactive
to False
, and as you can see above, answer yes
to the question.
For migration, this is much more complicated due to django signaling. The migrate
control itself does not ask any questions, but other installed applications can connect to pre_migrate_signal
or post_migrate_signal
and handle interactivity in their own way. The most common I know that contenttypes
For contenttypes
, interactive
means No.
if interactive: content_type_display = '\n'.join( ' %s | %s' % (ct.app_label, ct.model) for ct in to_remove ) ok_to_delete = input("""The following content types are stale and need to be deleted: %s Any objects related to these content types by a foreign key will also be deleted. Are you sure you want to delete these content types? If you're unsure, answer 'no'. Type 'yes' to continue, or 'no' to cancel: """ % content_type_display) else: ok_to_delete = False
source share