[Answered ]-Django 500 Error when DEBUG=FALSE, but only on some pages

2๐Ÿ‘

I added this to my settings.py file to trace the error to the console:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },

    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
     'console':{
            'level': 'DEBUG',
            'class': 'logging.StreamHandler',
        },
    },
    'loggers': {
        'django.request': {
            'handlers': ['console'],
            'level': 'ERROR',
            'propagate': True,
        },
    }
}

That told me that I had a missing css file that was causing the error. I ran python manage.py collectstatic and made sure that all my static files were where I was telling Django they were. This allowed the template to be rendered and it now works!

๐Ÿ‘คtay_thomp

Leave a comment