0

问题 错误是由于附件文件夹(post_office_attachments)无法在 linux 服务器上生成。

错误

/dev/generate_request/ 的 TypeError 类型“TypeError”的对象不是 JSON 可序列化的请求方法:POST Django 版本:2.2.3 异常类型:TypeError 异常值:
“TypeError”类型的对象不是 JSON 可序列化异常位置:/usr/ lib/python3.6/json/encoder.py 默认,第 180 行 Python 可执行文件:/usr/bin/python3

相关代码

尝试:

html = template.render(context) 

email_message = EmailMultiAlternatives(subject, html, from_email, [to_email])
    
email_message.attach_alternative(html, 'text/html')
    
template.attach_related(email_message)
    
email_message.send()
    
return "success" 

例外为 e:

return "Error: unable to send email due to" + e

哪段代码导致错误

template.attach_related(email_message)

4

0 回答 0