def send_error_report(url, exception, trace):
"""Send email when an error occurs."""
if settings.DEBUG is False:
email_context = {
'site': url,
'exception': exception,
'traceback': trace
}
message = get_template('scheduler_core/error_report_parsing.html').render(email_context)
error_email = EmailMessage('[MovieScheduler] Parsing Error Report',
message,
settings.SERVER_EMAIL,
settings.ADMINS)
error_email.content_subtype = 'html'
error_email.send(fail_silently=False)
else:
print("Exception: " + str(exception))
print("Traceback: ")
print(trace)
评论列表
文章目录