后端字符编码错误怎么解决

作者:hyoukaija 22 浏览 0 评论 发布时间:2021-04-22 15:00:02

admin后台运行时出问题,在模型列表页面可以显示,但是点击进去单个模型页面时会返回500,然后报下面的错误

File "/home/ec2-user/backend/env_starseed/lib/python3.8/site-packages/django/template/base.py", line 938, in render
    bit = node.render_annotated(context)
  File "/home/ec2-user/backend/env_starseed/lib/python3.8/site-packages/django/template/base.py", line 905, in render_annotated
    return self.render(context)
  File "/home/ec2-user/backend/env_starseed/lib/python3.8/site-packages/django/template/base.py", line 988, in render
    output = self.filter_expression.resolve(context)
  File "/home/ec2-user/backend/env_starseed/lib/python3.8/site-packages/django/template/base.py", line 698, in resolve
    new_obj = func(obj, *arg_vals)
  File "/home/ec2-user/backend/env_starseed/lib/python3.8/site-packages/simpleui/templatetags/simpletags.py", line 159, in get_value
    print(value)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 430-436: ordinal not in range(128)

简单排查: python版本3.8,sys.stdout.encoding=>'utf-8' django版本3.1.6

本地环境运行没问题,生产环境有问题

Loading...
评论列表 0条评论
暂时没有评论