Django 管理员登录 SSL_do_handshake() 失败

Django admin login SSL_do_handshake() failed

我在登录 django 网站的管理页面时在 nginx 错误日志中得到以下信息

2022/01/28 17:04:50 [crit] 22184#22184: *263 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 107.178.232.184, server: 0.0.0.0:443
2022/01/28 17:08:12 [crit] 22184#22184: *277 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 107.178.239.221, server: 0.0.0.0:443
2022/01/28 17:08:30 [crit] 22184#22184: *288 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 107.178.232.251, server: 0.0.0.0:443
2022/01/28 17:10:09 [crit] 22184#22184: *302 SSL_do_handshake() failed (SSL: error:14201044:SSL routines:tls_choose_sigalg:internal error) while SSL handshaking, client: 45.56.98.215, server: 0.0.0.0:443
2022/01/28 17:28:03 [crit] 22184#22184: *344 SSL_do_handshake() failed (SSL: error:141CF06C:SSL routines:tls_parse_ctos_key_share:bad key share) while SSL handshaking, client: 165.227.140.0, server: 0.0.0.0:443

一个可能的原因是我没有在制作 django 项目时使用的密钥,因为我丢失了 .env 文件。我使用 this answer 生成密钥并存储在 .env 文件中。是这个原因还是其他原因?

秘钥没有问题。我在生产中短暂地保留了 Debug=True 以找出出了什么问题,我得到了错误

AssertionError: database connection isn't set to UTC

这是因为 psycopg2 2.9> 与 Django 2 不兼容。2.x。从这个 answer 中发现并解决了问题。