Brainstorm's snippets (1/234)

  Removing the output of Django runserver

In settings:

#LOGGING_CONFIG = None

LOGGING = {
    'version': 1,
    'disable_existing_loggers': True,
    'handlers': {
        'null': {
            'class': 'logging.NullHandler',
        },
    },
    'loggers': {
        'django.server': {
            'handlers': ['null'],
            'level': 'INFO',
            'propagate': False,
        },
        ...
    },
}

# import logging.config
# logging.config.dictConfig(LOGGING)

If using channels, use 'django.channels.server' logger instead:

'loggers': {
    'django.server': {
        'handlers': ['null'],
        'level': 'INFO',
        'propagate': False,
    },
    'django.channels.server': {
        'handlers': ['null'],
        'level': 'INFO',
        'propagate': False,
    },
},

Filtering:

To print everything except 200 responses, you could use

./manage.py runserver 2>&1 | grep -v " 200 "