Python3 A server error occurred. Please contact the administrator.

Python Django项目 启动后 浏览器 http://localhost:8080/ 或者 http://127.0.0.1:8080/访问时正常,
用ip地址或者域名访问出现如下报错:

浏览器报错:A server error occurred.  Please contact the administrator

后台报错:UnicodeDecodeError: 'gbk' codec can't decode byte 0xa6 in position 9737: illegal multibyte sequence

在这里插入图片描述

解决办法:
settings.py中修改

ALLOWED_HOSTS = ['*']

在这里插入图片描述

修改后访问成功:

在这里插入图片描述

发布了50 篇原创文章 · 获赞 85 · 访问量 161万+

猜你喜欢

转载自blog.csdn.net/qq_24347541/article/details/89242350