Module Import alias ImportFrom alias ImportFrom alias Assign NameStore Call NameLoad Str ClassDef bases NameLoad body Expr Str FunctionDef arguments args NameParam defaults vararg kwarg body TryExcept body Expr Call AttributeLoad Call NameLoad NameLoad NameLoad attr NameLoad NameLoad handlers ExceptHandler type NameLoad name NameStore body Expr Call AttributeLoad NameLoad attr NameLoad keyword Call AttributeLoad NameLoad attr keyword Dict Str Num Raise decorator_list decorator_list
N/A N/A sys django.core.management.base BaseCommand logging getLogger N/A logger N/A getLogger django.commands LoggingBaseCommand N/A BaseCommand N/A N/A 
    A subclass of BaseCommand that logs run time errors to `django.commands`.
    To use this, create a management command subclassing LoggingBaseCommand:

        from django_extensions.management.base import LoggingBaseCommand

        class Command(LoggingBaseCommand):
            help = 'Test error'

            def handle(self, *args, **options):
                raise Exception


    And then define a logging handler in settings.py:

        LOGGING = {
            ... # Other stuff here

            'handlers': {
                'mail_admins': {
                    'level': 'ERROR',
                    'filters': ['require_debug_false'],
                    'class': 'django.utils.log.AdminEmailHandler'
                },
            },
            'loggers': {
                'django.commands': {
                    'handlers': ['mail_admins'],
                    'level': 'ERROR',
                    'propagate': False,
                },
            }

        }

     execute N/A N/A self N/A args options N/A N/A N/A N/A N/A N/A N/A super LoggingBaseCommand self execute args options N/A N/A N/A Exception N/A e N/A N/A N/A N/A logger error e exc_info N/A N/A sys exc_info extra N/A status_code 500 N/A N/A N/A