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

Python3 A server error occurred. Please contact the administrator._第1张图片

解决办法:
settings.py中修改

ALLOWED_HOSTS = ['*']

Python3 A server error occurred. Please contact the administrator._第2张图片

修改后访问成功:

Python3 A server error occurred. Please contact the administrator._第3张图片

你可能感兴趣的:(python,python自我成长之路)