django apache2 mysql 中的 ascii 错误代码

django apache2 mysql 中的 ascii 错误代码

我部署了使用 Apache 和 MySQL 的 Django 项目。所有应用程序功能都运行良好,但是在应用程序的 views.py 中,当我尝试访问它时,它会引发此错误。

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9735: ordinal not in range(128)

我搜索了很多,但没有一个适合我。应用程序的查询也views.py有很多(用于计算)?annotate and aggregateCase(When())

这是我的错误日志

[Fri Aug 21 14:30:46.907352 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151]   File "/var/www/projectname/venv/lib/python3.6/site-packages/django/views/debug.py", line 94, in technical_500_response
[Fri Aug 21 14:30:46.907356 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151]     html = reporter.get_traceback_html()
[Fri Aug 21 14:30:46.907362 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151]   File "/var/www/projectname/venv/lib/python3.6/site-packages/django/views/debug.py", line 332, in get_traceback_html
[Fri Aug 21 14:30:46.907379 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151]     t = DEBUG_ENGINE.from_string(fh.read())
[Fri Aug 21 14:30:46.907387 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151]   File "/usr/lib/python3.6/encodings/ascii.py", line 26, in decode
[Fri Aug 21 14:30:46.907391 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151]     return codecs.ascii_decode(input, self.errors)[0]
[Fri Aug 21 14:30:46.907402 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12151] UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 9735: ordinal not in range(128)
[Fri Aug 21 14:30:50.086155 2020] [wsgi:error] [pid 20969:tid 140683116439296] [remote 95.159.84.254:12181] Not Found: /favicon.ico
[Fri Aug 21 11:36:30.228905 2020] [mpm_event:notice] [pid 20966:tid 140683347807168] AH00491: caught SIGTERM, shutting down
[Fri Aug 21 11:36:30.330450 2020] [mpm_event:notice] [pid 21882:tid 140691412487104] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Aug 21 11:36:30.330585 2020] [core:notice] [pid 21882:tid 140691412487104] AH00094: Command line: '/usr/sbin/apache2'
[Fri Aug 21 12:15:09.336685 2020] [mpm_event:notice] [pid 21882:tid 140691412487104] AH00491: caught SIGTERM, shutting down
[Fri Aug 21 12:15:09.451585 2020] [mpm_event:notice] [pid 22113:tid 139983902116800] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Aug 21 12:15:09.451973 2020] [core:notice] [pid 22113:tid 139983902116800] AH00094: Command line: '/usr/sbin/apache2'
[Fri Aug 21 12:51:39.616795 2020] [mpm_event:notice] [pid 22113:tid 139983902116800] AH00491: caught SIGTERM, shutting down
[Fri Aug 21 12:51:39.714991 2020] [mpm_event:notice] [pid 22639:tid 140292123478976] AH00489: Apache/2.4.29 (Ubuntu) mod_wsgi/4.5.17 Python/3.6 configured -- resuming normal operations
[Fri Aug 21 12:51:39.715191 2020] [core:notice] [pid 22639:tid 140292123478976] AH00094: Command line: '/usr/sbin/apache2'

相关内容