'Returns the static files serving handler wrapping the default handler,
if static files should be served. Otherwise just returns the default
handler.'

def get_consumer(self, *args, **options):

    staticfiles_installed = apps.is_installed('django.contrib.staticfiles')
    use_static_handler = options.get('use_static_handler', staticfiles_installed)
    insecure_serving = options.get('insecure_serving', False)
    if (use_static_handler and (settings.DEBUG or insecure_serving)):
        return StaticFilesConsumer()
    else:
        return ViewConsumer()
