I can't find this in the docs. When I run python manage.py collecstatic --no-input does it mean it will answer "yes" to any prompt that would pop up in the process? The same for python manage.py migrate --no-input. 
            Asked
            
        
        
            Active
            
        
            Viewed 1.5k times
        
    24
            
            
         
    
    
        Alejandro Veintimilla
        
- 10,743
- 23
- 91
- 180
- 
                    1I think generally, it's to answer `yes`, but I've noticed before bugs with it failing to remove stale content types. https://code.djangoproject.com/ticket/25036 – wim Jan 30 '17 at 18:51
1 Answers
39
            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 for collect static, if you set --no-input it will set interactive to False and, as you can see above, will answer yes to the question for you.
For migrate it is much trickier because of django signaling.  The migrate management itself does not ask any questions, but other installed apps may hook into the pre_migrate_signal or post_migrate_signal and handle interactivity in their own way.  The most common one I know of is contenttypes
For contenttypes, --no-input answers "no" as in "No, please don't delete any stale contenttypes":
        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
 
    
    
        2ps
        
- 15,099
- 2
- 27
- 47